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

fix: encodeURI for thumbnails and timelapse files #539

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

ngynkvn
Copy link
Contributor

@ngynkvn ngynkvn commented Jan 17, 2022

GET requests including file names with special characters such as '%' will properly encode the request to the server.

Description

I run mainsail and moonraker behind Nginx. My g-code files are named to include infill percentage, i.e. "25%", which for URLs is a reserved escape character. Nginx parses these requests incorrectly and returns a 400 Bad Request code, leaving thumbnail icons and timelapse videos inaccessible for me.

Before fix:

Before

Clicking the first file in timelapse view breaks:

Before2

Note the g-code file without the '%' symbol successfully obtains it's thumbnail, but all others are breaking.

I did a grep through the code base and replaced lines where encodeURI was missing for the GET request.

After fix:

Working2

The first timelapse video is successfully found and displayed:

working-vid

Lmk about any concerns, and thank you for providing a great and useful UI! 🎉

GET requests including file names with special characters such as '%' will properly encode the request to the server.
@meteyou meteyou merged commit 7b19c90 into mainsail-crew:develop Jan 18, 2022
@meteyou
Copy link
Member

meteyou commented Jan 18, 2022

thx for the PR!

@wlhlm
Copy link

wlhlm commented Jan 18, 2022

Heads up: Funneling the whole URL through encodeURI() will most likely break for users on IPv6 as can be seen in the following fluidd PR: fluidd-core/fluidd#439

@meteyou
Copy link
Member

meteyou commented Jan 18, 2022

Heads up: Funneling the whole URL through encodeURI() will most likely break for users on IPv6 as can be seen in the following fluidd PR: fluidd-core/fluidd#439

thx for your feedback. should be fixed with this commit: 56d61ce

@ngynkvn ngynkvn deleted the fix/uri-encoding-thumbs branch January 21, 2022 15:07
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

Successfully merging this pull request may close these issues.

3 participants