Skip to content

better input validation for bookmarks dialog#4343

Open
VishnuSanal wants to merge 1 commit into
release/4.0from
bookmark-dialog-fix
Open

better input validation for bookmarks dialog#4343
VishnuSanal wants to merge 1 commit into
release/4.0from
bookmark-dialog-fix

Conversation

@VishnuSanal

Copy link
Copy Markdown
Member

fixes #4337, #4336, #4335 & #4334

@VishnuSanal VishnuSanal added the PR-Awaiting-Initial-Review this PR is awaiting for an initial review label Jan 13, 2025
@EmmanuelMess

Copy link
Copy Markdown
Member

@VishnuSanal fix CI

@VishnuSanal

Copy link
Copy Markdown
Member Author

codacy cries about using a label in return. seems unreasonable.


val result = isValidBookmark(editText1.text.toString(), editText2.text.toString())
if (!result.first) {
Toast.makeText(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a snackbar per Android guidelines https://developer.android.com/guide/topics/ui/notifiers/toasts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I feel like a toast is better in this scenario since snackbar appears below the keyboard. WDYT?

(ideally we should surface this to the dialog box itself like the create dialog - which I guess can be tracked later)

int i = 0;
for (String[] x : b) {
if (x[0].equals(a[0]) && x[1].equals(a[1])) return i;
if (x[0].equals(a[0]) || x[1].equals(a[1])) return i;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this (DataUtils::constains) function is very opaque, what is it actually doing? Whats the fix doing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes were because both the name / path should be unique since we cannot have two items with the same name

I have added a javadoc too, thanks!

(but this prevents two bookmarks / servers pointing to the same path with different names - whihc I feel is not a practical usecase)

@EmmanuelMess

Copy link
Copy Markdown
Member

codacy cries about using a label in return. seems unreasonable.

I think we either need to ignore the issue project wise or ignore on the line to actually be able to merge.

@VishnuSanal VishnuSanal added PR-Requested-Changes this PR is awaiting an update from the author and removed PR-Awaiting-Initial-Review this PR is awaiting for an initial review labels Feb 12, 2025
… & #4334

Signed-off-by: VishnuSanal <t.v.s10123@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Requested-Changes this PR is awaiting an update from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A bookmark can be created with an invalid directory if the directory is entered before the bookmark name.

2 participants