kintesh / containerise

Firefox extension to automatically open websites in a container
MIT License
415 stars 53 forks source link

Path matching fails on paths with capitals #177

Open mikedlr opened 1 year ago

mikedlr commented 1 year ago

Regexps containing capitals are converted to lower case but then fail to match paths which contain capitals.

What I did

@?.*.example.com/UpperCase go to www.example.com/UpperCase

What happens

When I enter the string above it gets converted to lower case

@?.*.example.com/UpperCase

and then the match fails.

What I expected to happen

the regexp should maintain case (possibly excluding the domain name? not sure how to handle this) the site with an upper case character in the path sshould be possible to match

Cybolic commented 1 year ago

Can confirm this. My workaround for now is to write them as @?.*.example.com/.pper.ase, which is obviously not ideal.

I'd recommend picking one of these solutions:

  1. Keep lower-casing the user input, but make the regexes case insensitive by default (/i).
  2. Don't touch the case of the user input.

Option one is more in line with the current behaviour and probably makes the most sense as most web servers don't care about case anyway.

iainelder commented 1 year ago

Don't touch the case of the user input

I'd prefer this option. Just trust that I know what I'm doing with my input. If the regex ends up being invalid or slow, then fail gracefully, but don't force all the uppercase I just typed in to be lowercase. That's annoying.

iainelder commented 1 year ago

make the regexes case insensitive by default

@Cybolic , do you know how to set a single regex to be case sensitive? Containerise seems to have a proprietary syntax for defining one.

I think a JavaScript regex would have an i after the closing /, but Containerise's regexes are not surrounded by /.

iainelder commented 1 year ago

My use case is a URL for a Slack workspace such as https://app.slack.com/client/A11A11A1AAA/A11AA1AAAA.

If I need to replace every capital letter with a . to work around the case sensitivity, then all I can match on are the numbers. It might just work, but it feels quite shoddy.

ipwnponies commented 4 months ago

This is a duplicate issue, I posted a workaround https://github.com/kintesh/containerise/issues/120#issuecomment-2116002236