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

consider using === in network blacklist matching #405

Open
Nakilon opened this issue Sep 23, 2023 · 0 comments
Open

consider using === in network blacklist matching #405

Nakilon opened this issue Sep 23, 2023 · 0 comments

Comments

@Nakilon
Copy link
Contributor

Nakilon commented Sep 23, 2023

The String#match is doing funny things

irb(main):023:0> "vg?1".match "vg?1"
=> nil
irb(main):024:0> "g?1".match "g?1"
=> #<MatchData "1">

here


and since you send regex on url and not vice versa, I believe it isn't intended.
So I propose to make it like this instead:

      def match?(regexp)
        not not regexp === url
      end

because it was too surprising that when I added an exact url string it didn't match, such as "https://telegram.org/img/tgme/pattern.svg?1".

Have no time to come up with a PR, just patched in a fork.

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