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

[BUG] Thumbnails don't load if their path contains a "%" character #1117

Open
Kramoule opened this issue May 16, 2024 · 1 comment
Open

[BUG] Thumbnails don't load if their path contains a "%" character #1117

Kramoule opened this issue May 16, 2024 · 1 comment

Comments

@Kramoule
Copy link

Describe the bug
Thumbnails don't load if their filename contains a "%" character.
I have also investigated the issue.

The docker logs are:

0|YoutubeDL-Material  | URIError: URI malformed
0|YoutubeDL-Material  |     at decodeURIComponent (<anonymous>)
0|YoutubeDL-Material  |     at /app/app.js:1684:21
...(truncated)

The error apparently comes when it's trying to decode the URI path parameter.

app.get('/api/thumbnail/:path', optionalJwt, async (req, res) => {
let file_path = decodeURIComponent(req.params.path);
(The line number in app.js inside the container doesn't correspond with the line in the repo)

But the Express documentation says that req.params is already decoded:

NOTE: Express automatically decodes the values in req.params (using decodeURIComponent).

(Source: https://expressjs.com/en/4x/api.html#req.params)

So the backend here is actually trying to decode an already valid filepath.
For example with a filepath audio/100%Bug.webp: decodeURIComponent("audio/100%Bug.webp") will return an error.

A solution is to simply remove the decodeURIComponent function if it served no purpose.

To Reproduce
Steps to reproduce the behavior:

  1. Download any video that has a % character or set a custom output name which contains a "%" ("100%Bug" for example)
  2. Go to the main page and see your files

Expected behavior
Your files should display the thumbnail, as usual.

Screenshots
Window-2024-05-16 03_06_04

Environment

  • YoutubeDL-Material v4.3.2
  • Docker tag: latest (optional)
@Kramoule
Copy link
Author

Kramoule commented May 16, 2024

Of course, if you download a single video and put a custom output name which doesn't have any "%" in it, everything work fine, but you can't always do that with subscriptions.

Kramoule added a commit to Kramoule/YoutubeDL-Material that referenced this issue May 18, 2024
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