-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
web: Crash when serializing objects with bytes fields #2532
Comments
Hmm; thanks for reporting! I think we may have fixed some similar issues in the web plugin recently. Can I ask you the favor of trying out the latest source? (There are instructions for running the latest source in our FAQ.) Thanks again! |
Sure! Let me pull that down |
So I tried it with the
I'm going to check and make sure that just pulling from master doesn't give different results. |
Yep, more of the same:
It's the same so I'll not repeat the rest. |
Alright, so I've taken an attempt to try and learn a bit more, but I'm running up against the limits of my understanding of the internals of the library. Adding a
I think this is the important item:
I went through to the I would try to find a way to add a Is this the right direction to go in to fix it? I don't mind digging a bit further to fix it myself but I'm not sure where the sql call get's turned into an actual object that I can manipulate before it gets out to the JSON serializer. |
Thanks for continuing to investigate! Yes, I agree that paths are probably related to the problem, but we actually remove the path field by default (and if the paths are enabled, we decode them to stings): beets/beetsplug/web/__init__.py Line 41 in 84febb1
It's strange that I can't reproduce this error… maybe it would be useful to try doing a |
Ah, I see now. Thanks for pointing that out to me. It does look like it is taking the path out:
And hey! I figured it out! It's the If you want to deal with this in place with the For now I tested just adding a It might be worthwhile for that patch to include some kind of framework additional plugins can hook into that declares dangerous values like that. That would make it so that you don't have to hardcode it in place here for all the addins which may or may not be present on a person's particular configuration. Just a thought, and I'm open to implementing and documenting it as a project. |
With a bit more tinkering I found that even with the I still think it would be a bit heavy handed an approach to manually add any bytes or other non realizable data tags individually by hand. Might be better to scan through and delete any bytes tags by default but allow an extension to override the behaviour if the end user has that extension loaded. |
Got it; thanks for nailing it down! I think the right solution is indeed to fix
|
beet web
: TypeError: Object of type 'bytes' is not JSON serializableThis commit fixes issue beetbox#2532 by filtering out any byte values added by any other extensions and decoding them to strings for the JSON serializer. It does not remove any of the keys, instead opting to just convert them. Signed-off-by: Mark Stenglein <[email protected]>
This commit fixes issue beetbox#2532 by filtering out any byte values added by any other extensions and decoding them to strings for the JSON serializer. It does not remove any of the keys, instead opting to just convert them. Signed-off-by: Mark Stenglein <[email protected]>
This commit fixes issue beetbox#2532 by filtering out any byte values added by any other extensions and decoding them to strings for the JSON serializer. It does not remove any of the keys, instead opting to just convert them. Signed-off-by: Mark Stenglein <[email protected]>
This commit fixes issue beetbox#2532 by filtering out any byte values added by any other extensions and decoding them to strings for the JSON serializer. It does not remove any of the keys, instead opting to just convert them. Signed-off-by: Mark Stenglein <[email protected]>
That PR should fix the problem by decoding the byte values to strings. I'm not sure if it's correctly using base64 as you suggested, but I'm also not sure how to do that if it's not already in that form. |
web: #2532 - Decode bytes values to strings
Problem
For some reason the web interface is not working correctly. I can't actually get it to search for anything. When you type something into the search box nothing happens except for the following text being printed to the terminal.
Running this command in verbose (
-vv
) mode:Then searching for something in the web interface gives this problem:
Setup
My configuration (output of
beet config
) is:The text was updated successfully, but these errors were encountered: