Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bukuserver] Non-conflicting URL parameters in GUI #638

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

LeXofLeviafan
Copy link
Collaborator

fixes #635:

  • renaming the url param to link in HTML forms & queries (excluding the API)

also:

@LeXofLeviafan
Copy link
Collaborator Author

To clarify the last two points:
image

@rachmadaniHaryono
Copy link
Collaborator

note for the pr

  • buku only check if url is not empty so whitespace is also valid ' ' see 1
    • but not on bukuserve due to 2
  • maybe not set url on anchor tag if scheme is either http or https but no netloc for example http:robert
    • http:robert will link to http://127.0.0.1:5000/bookmark/robert
    • related issue is 3
    • doc on uri 4 and 5
  • bookmarklet also work

example of whitespace url on buku

$  python -m buku --nostdin -a '   '
Malformed URL

2653. Untitled
   >

my linter note this on views.py, this could be fixed later

bukuserver/views.py|67 col 12-16 note| "data" is not accessed
bukuserver/views.py|71 col 31-32 error| Argument of type "Literal[0]" cannot be assigned to parameter "__arg1" of type "SupportsRichComparisonT@max" in function "max"   Type "int" cannot be assigned to type "str"     "int" is incompatible with "str"
bukuserver/views.py|96 col 35-39 note| "name" is not accessed
bukuserver/views.py|96 col 41-48 note| "options" is not accessed
bukuserver/views.py|234 col 42-51 note| "sort_desc" is not accessed
bukuserver/views.py|234 col 30-40 note| "sort_field" is not accessed
bukuserver/views.py|244 col 26-39 error| Object of type "None" is not subscriptable
bukuserver/views.py|251 col 21-30 error| Argument of type "Iterable[Any] | list[Any] | list[Unknown]" cannot be assigned to parameter "__obj" of type "Sized" in function "len"   Type "Iterable[Any] | list[Any] | list[Unknown]" cannot be assigned to type "Sized"     "Iterable[Any]" is incompatible with protocol "Sized"       "__len__" is not present
bukuserver/views.py|290 col 34-40 note| "widget" is not accessed
bukuserver/views.py|290 col 47-57 note| "validators" is not accessed
bukuserver/views.py|426 col 41-48 note| "options" is not accessed
bukuserver/views.py|426 col 35-39 note| "name" is not accessed
bukuserver/views.py|490 col 47-57 note| "validators" is not accessed
bukuserver/views.py|490 col 34-40 note| "widget" is not accessed
bukuserver/views.py|500 col 26-30 error| Expression of type "None" cannot be assigned to parameter of type "int"   Type "None" cannot be assigned to type "int"
bukuserver/views.py|605 col 28-32 note| "form" is not accessed

sorry for late review

unrelated but title and description here is actually not stripped

buku/bukuserver/views.py

Lines 205 to 206 in bddc938

if item.strip():
kwargs[key] = item

@jarun jarun merged commit 92bdcde into jarun:master Dec 13, 2022
@jarun
Copy link
Owner

jarun commented Dec 13, 2022

Thank you!

@LeXofLeviafan
Copy link
Collaborator Author

LeXofLeviafan commented Dec 13, 2022

buku only check if url is not empty so whitespace is also valid ' ' see 1
but not on bukuserve due to 2

Well this can be fixed separately if it's actually necessary to be able to support URLs consisting only of whitespace 😄
…Incidentally, the second condition in buku code (url == '') is never checked due to the first one (not url) covering it: empty collections (including strings) are falsey in Python 😅

maybe not set url on anchor tag if scheme is either http or https but no netloc for example http:robert

Makes sense, but I suppose this should be reported as a separate issue (along with the "whitespace URLs" I guess), and it sounds like a fairly low severity issue to me so it can be resolved whenever.

Edit: added #642

unrelated but title and description here is actually not stripped

As far as I can tell, this code simply checks whether the string is blank to decide if it should be used (but doesn't modify user input when using it, which seems like a valid behaviour).

@LeXofLeviafan
Copy link
Collaborator Author

my linter note this on views.py, this could be fixed later

As for this, there's barely anything that could be fixed at all in this list – for the most part the linter here is just getting confused by overloaded methods.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2023
@LeXofLeviafan LeXofLeviafan deleted the url-param-rename branch August 24, 2024 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bookmark create/edit form in bukuserver uses a reserved query parameter
3 participants