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

[PeerTube] Do not accept non-URLs #1143

Merged
merged 2 commits into from
Dec 29, 2023
Merged

Conversation

petlyh
Copy link
Contributor

@petlyh petlyh commented Dec 26, 2023

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API.
    No NewPipe changes are needed.

This PR makes the PeerTube onAcceptUrl methods return false if the input is not a valid URL.
This is done by passing the input to the URL constructor and returning false if a MalformedURLException gets caught.

The PeerTube onAcceptUrl methods currently only checks whether the input contains path parts like /videos/ or /a/.
This causes problems when they get called when NewPipes SearchFragment.search checks whether the users search query is an accepted URL, since non-URL search queries can contain those parts. TeamNewPipe/NewPipe#10695 is caused by the search query orchestr/a/ being interpreted as a PeerTube Account URL because it contains /a/.

Fixes TeamNewPipe/NewPipe#10695

@TobiGr TobiGr added bug peertube service labels Dec 26, 2023
@TobiGr
Copy link
Member

TobiGr commented Dec 27, 2023

Thank you! Can you also add test cases to ensure we won't introduce this unwanted behaviour again? (e.g. here)

@TobiGr TobiGr force-pushed the peertube-non-urls branch 2 times, most recently from ef86112 to 4dc75f4 Compare December 29, 2023 11:43
Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I added the tests

@TobiGr TobiGr merged commit 038ebde into TeamNewPipe:dev Dec 29, 2023
4 checks passed
@TobiGr TobiGr changed the title Avoid PeerTube accepting non-URLs [PeerTube] Do not accept non-URLs Dec 29, 2023
@petlyh petlyh deleted the peertube-non-urls branch December 29, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Searching for "orchestr/a" works but not "orchestr/a/".
3 participants