-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Bookmarklet handling form in bukuserver ignores entered values #639
Comments
…It seems that the cause of the problem is twofold:
Edit: Forgot to add – the desciption field is initially empty because it's implemented differently in the bookmarklet: it attempts to read selected text (…which I believe isn't mentioned anywhere except its source), and if there's no text selected it doesn't fall back to default behaviour. |
to summarize
yes, but bukuserver use the default form from flask admin so no button to close window it is above section is made before i read your second post
that is default bukudb behaviour
@jarun , i assume there is, i will check it later
this is actually an issue. there are 2 ways to go about it
i favour option 2 and edit the create bookmark form
i'm on bf0f7af and i can't reproduce it , steps:
compare this to add only buku url
unrelated i may not be able to test pr / reply issue from friday - sunday, also i havent work on network test cache yet, so it may have to wait till monday |
See my edit of the previous post
Are you sure you've understood my explanation correctly? Here's the user actions:
|
Buku API has the parameter to control it, but there's no option to use it from the GUI |
i can reproduce the issue with your steps this is weird one because without edit just like my steps, description data is kept if it is not empty another weird behavior
expected behaviour: description should be baz unrelated but there is error when changing between tabs when creating bookmark 127.0.0.1 - - [08/Dec/2022 11:35:03] "GET /bookmark/details/?id=2648&url=%2Fbookmark%2F HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 2548, in __call__
return self.wsgi_app(environ, start_response)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.handle_exception(e)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask_api/app.py", line 106, in handle_user_exception
raise e
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/home/r3r/.pyenv/versions/buku/lib/python3.10/site-packages/flask_admin/model/base.py", line 2183, in details_view
model = self.get_one(id)
File "/mnt/ac54dceb-73a5-4f94-b52c-cb7a426c0f29/Documents/Buku/bukuserver/views.py", line 281, in get_one
setattr(bm_sns, field.name.lower(), bookmark[field.value])
TypeError: 'NoneType' object is not subscriptable |
I'm not sure how it's different from what I described… Or is the weird part that the edit of non-empty description got reset? I've described what's happening there in the second comment.
How did it happen? The only way I've managed to reproduce it is by pressing "Save and Add Another" then "Save and Continue Editing" (because P.S. Turns out it's possible to close the tab automatically if it's opened in a popup window (i.e. by the bookmarklet) – if I add this in Also I've managed to reproduce (more or less) fetch behaviour of buku in the bookmarklet as fallback behaviour (i.e. detecting description from metadata if no text is selected). |
Note: this happens only when I don't change the URL before saving ( Edit: it does according to the source, but is this behaviour documented? I can't seem to find any mention of it anywhere. |
instead of value from bukudb it default to selected text
i think i am mistaken between creating record and editing it full step
if it is easy, add it
it mention failure and include the case of url already exist on db that one? or you mean something else |
Er, I mean… You just deleted it. The page you're navigating to no longer exists 😅 Edit: this condition can be handled by the code – I'll include it in my next commit.
When I said "documented", I meant outside of the source – it seems to be a behaviour that would affect UX. Somehow I doubt that the CLI which uses this function would behave differently from it. |
it should be 404 instead of NoneType error
something like this on example section (between example 1 and 2)
The command will add the url to buku. Title and description will be fetched from the site. Buku only keep the unique url and it will raise error if the url already exist |
I've committed a fix – I think it covers everything from here? Except for documentation changes and the option to turn off auto-filling empty fields. It's based off bf0f7af so there's little point in making a pull request for it until the other one is merged.
👍 |
…Added several more commits – I've put them on a separate branch but I'm thinking of making a pull-request from it directly since it includes d0b86ce anyway (which hasn't made it to a pull-request yet due to being dependent on #638). Originally it was meant as a single commit but it got slightly out of hand so I decided to split it into several for clarity. It includes a checkbox in create form allowing to turn off fetch functionality, moving of API into a separate file, and a bunch of minor fixes & improvements in bukuserver code (mostly in templates, plus responses code duplication in API). I've also added a |
I've created a separate issue for this, to ensure it isn't lost & forgotten. |
When using the bookmarklet to open a "modal" window with create bookmark form, the Url and Title fields are pre-filled; the user then can modify the form data however he likes before submitting it.
However, regardless of the changes made by user, the only value from his input that gets saved to DB is Tags – the rest are taken from the page data. Worse yet, the user can't even see the Description value until the form is submitted (it's not displayed in the respective field of creation form).
P.S. Also it would make more sense to close the "modal" window on Save/Cancel click, would it not?
The text was updated successfully, but these errors were encountered: