Skip to content

chores: Broaden the NND MyList link matcher #1896

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

szc126
Copy link
Collaborator

@szc126 szc126 commented Feb 2, 2025

Comment on lines +947 to +950
// matching both
// https://www.nicovideo.jp/mylist/000 (old URL style) and
// https://www.nicovideo.jp/user/000/mylist/000 (new URL style)
url: '/mylist/',
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to have two entries in WebLinkMatcher.ts for the new and the old style rather than including this one matcher without a host

Copy link
Collaborator Author

@szc126 szc126 Feb 2, 2025

Choose a reason for hiding this comment

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

I initially did that, but then I realized that the one with the host would be redundant as the short one would match a superset; but I also understand the argument that it's stylistically better

(well, actually, I put in nicovideo.jp/user/\d+/mylist/, before realizing that these are not regular expressions; then I reduced it to /mylist/ and then replaced the matcher for the old style entirely…)

Copy link
Member

Choose a reason for hiding this comment

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

I'm really sorry for the late reply. My main argument for two separate entries is to still keep the host (https://www.nicovideo.jp) in the matcher to keep URLs who just happen to include /mylist/ from matching with this matcher

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My understanding is that

  • https://www.nicovideo.jp/mylist/000 can be matched with nicovideo.jp/mylist/ (current behavior), but
  • https://www.nicovideo.jp/user/000/mylist/000 must be matched with the host-less /mylist/ (proposed edit), and cannot have a host (ideally nicovideo\.jp/user/\d+/mylist/ if represented in regex) due to the simplistic use of indexOf (not regex) that cannot handle the necessary wildcard for the intervening /user/000/, and
  • nicovideo.jp/mylist/ would then be a redundant test to /mylist/.

This *does* allow "false positives" for other hosts, but I am not sure if this would happen in practice.

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.

2 participants