Skip to content

Fix block channel channel ID validation#4366

Merged
FreeTubeBot merged 1 commit intoFreeTubeApp:developmentfrom
absidue:fix-channel-block-id-regex
Nov 21, 2023
Merged

Fix block channel channel ID validation#4366
FreeTubeBot merged 1 commit intoFreeTubeApp:developmentfrom
absidue:fix-channel-block-id-regex

Conversation

@absidue
Copy link
Member

@absidue absidue commented Nov 20, 2023

Fix block channel channel ID validation

Pull Request Type

  • Bugfix

Related issue

Noticed while testing #4347

Description

This fixes the regex used to validate the channel IDs passed into the block channel box in the distraction free settings. The regex was missing the start (^) and end ($) anchors, which means that this invalid string bla-UCUQo7nzH1sXVpzL92VesANw-bla would be seen as a valid channel ID, resulting in requests getting sent to YouTube and Invidious which then understandably errored. This pull request adds those missing anchors so that the regex test only returns true if the whole string matches, instead of just a substring, I also changed it from \S, which is any non-whitespace character, to [\w-] (A-Za-z0-9_-), previously strings like this would be counted as valid UC@@@@@@@@@@@@@@@@@@@@@@ too.

Testing

bla-UCUQo7nzH1sXVpzL92VesANw-bla
UC@@@@@@@@@@@@@@@@@@@@@@

It should now show "Channel ID provided was invalid", instead of sending a request to YouTube and Invidious, erorring with "Error retrieving user with the ID provided. Please check again if the ID is correct."

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.19.1 (nightly as the original pull request was merged after the 0.19.1 release)

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 20, 2023
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 20, 2023 22:24
@FreeTubeBot FreeTubeBot merged commit c219926 into FreeTubeApp:development Nov 21, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 21, 2023
@absidue absidue deleted the fix-channel-block-id-regex branch November 21, 2023 05:11
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 23, 2023
* development:
  Translated using Weblate (Italian)
  Translated using Weblate (Polish)
  Translated using Weblate (Kurdish (Central))
  Translated using Weblate (Spanish)
  Translated using Weblate (Kurdish (Central))
  Translated using Weblate (Kurdish)
  A new way to subscribe (FreeTubeApp#4238)
  Display more profiles on the profile drop-down list, v2 (fixed for low res, fixed linter)  (FreeTubeApp#4359)
  Translated using Weblate (Estonian)
  Translated using Weblate (Serbian)
  Translated using Weblate (Arabic)
  Translated using Weblate (Chinese (Simplified))
  Display currently watching viewer count on live streams (FreeTubeApp#4206)
  Translated using Weblate (Spanish)
  Translated using Weblate (Czech)
  Translated using Weblate (Chinese (Traditional))
  Translated using Weblate (Italian)
  Fix block channel channel ID validation (FreeTubeApp#4366)
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.

5 participants