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

Request parsing fails when using Werkzeug>2.0.3 #39

Open
mofe23 opened this issue Oct 12, 2022 · 0 comments
Open

Request parsing fails when using Werkzeug>2.0.3 #39

mofe23 opened this issue Oct 12, 2022 · 0 comments

Comments

@mofe23
Copy link

mofe23 commented Oct 12, 2022

Hi,
let's start with the good news: THX for your code, after initial debugging it did exactly what i was looking for :)

Now the bad ones:

After solving installation problems of wxPython by running pip install attrdict3 before installing orangeshare, I've discovered further problems using Python 3.10 on ArchLinux:

When I tried to add a new device, an alert popped up saying

Error: {"message": "The browser (or proxy) sent a request that this server could not understand."}

After some initial confusion, I discovered the problem was introduced in Werkzeug's version 2.1.0 by a change of Request.get_json() now raising BadRequest Errors if ContentType not explicitly set to application/json.

Several ways to fix orangeshare exist. I've confirmed setting contentType="application/json" and using JSON.stringify for every $.post works. Also, installing Wertkzeug==2.0.3 fixes the issue, but I think explicitly setting location="form" in RequestParser.add_argument is the "most correct" fix, as is keeps your initial intent of sending FormData and as you're rewriting the server side anyway, I'd prefer not to change the JS part --> PR incoming!.

Furthermore, to prevent issues like this one introduced by 3rd party updates, I'd recommend pinning dependencies to versions known to work.

Have a good one,
Mo

mofe23 added a commit to mofe23/Orange-Share that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant