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

Add check for Content-Type when downloading tracker list #22137

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

userwiths
Copy link

@userwiths userwiths commented Jan 10, 2025

Closes #13061.

Description

Some users might get confused around platforms like github and their raw links. By mistake such user has entered the HTML page link and each HTML line was taken as a tracker.
In order to fix this issue, we add a check on the Content-Type header of the response. We accept text/plain and show a descriptive error message otherwise.

Check if the URL from where we are downloading the trackers returns `Content-Type` as `text`.
Otherwise consider it might be a non-usable format for this functionality (html,xml,etc.ect.)
@glassez
Copy link
Member

glassez commented Jan 10, 2025

Some users might get confused around platforms like github and their raw links. By mistake such user has entered the HTML page link and each HTML line was taken as a tracker.
In order to fix this issue, we add a check on the Content-Type header of the response. We accept text/plain and show a descriptive error message otherwise.

The plain text may also contain arbitrary/inappropriate data. Shouldn't the lines themselves be validated instead?

@userwiths
Copy link
Author

I thought that the text area was meant to be used in order to "preview" the url's a user was about to add.
But I agree that we could limit their chances of entering gibberish accidentally.
Latest commit adds a simple check to see if the text looks like a url.

@glassez glassez changed the title fix: Add check for Content-Type when downloading tracker list. Add check for Content-Type when downloading tracker list Jan 10, 2025
@stalkerok
Copy link
Contributor

stalkerok commented Jan 10, 2025

Doesn't work, incorrect list added without a problem.
Working.
2025-01-11_000558
But it looks like you need to add checking here as well.
2025-01-10_234802

@userwiths userwiths requested a review from Chocobo1 January 13, 2025 16:34
@stalkerok
Copy link
Contributor

Tested!

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.

Perform a check when adding an incompatible list URL
4 participants