zumoshi / BrowserSelect

Browser Select is a utility to dynamically select the browser you want instead of just having one default for all links.
GNU General Public License v2.0
289 stars 39 forks source link

Priority for filters #63

Closed Graham-sr closed 4 years ago

Graham-sr commented 4 years ago

I am confused regarding priorities for some filters. If one filter rule is simply * then it seems to take priority over all others. This is regardless of the order in which the filter rules are created.

This seems to go against the examples provided such as ◦rule 1: -> Firefox ◦rule 2: .companywebsite.com -> IE If I put my own site into rule 2 it is not actioned, it opens in Firefox If I reverse the order to ◦rule 1: .companywebsite.com -> IE ◦rule 2: -> Firefox it still opens in Firefox.

Any suggestions?

zumoshi commented 4 years ago

Hello, As per this line of code, Rules have 3 levels of priorities, beyond which they are checked by order of insertion. 0, or highest, when they don't include *. 1 if they include *, and 2 if the rule is just *.

I just tested with these two rules on v1.4.1: image and it worked as expected. As in it opened: http://a.com -> Vivaldi http://b.com -> Firefox http://c.b.com -> Firefox

Please check your rules for spelling, make sure they are saved, and test again. If you still have problems please include example URLs and a screenshot of your rules. or your user.config file (from this path): C:\Users\<User>\AppData\Local\BrowserSelect\BrowserSelect.exe_Url_4j4dimlkqsgapflatinf2e2ay1t1qfzx\1.4.1.0\user.config

Graham-sr commented 4 years ago

Thanks for the clarification.

I discovered that the link I was using to test the program had an error. It ended with a slash ( / ). Although I included this in the 'rule' the program did not like it. By removing the slash everything worked.

zumoshi commented 4 years ago

At the moment the rules only support the domain section of URL. So you can't match any other parts such as the protocol, path, port, or query arguments.

In future versions I intend to add support for other parts of URL, but in the short term adding some validation might not be a bad idea. Since the domain part can never include a colon or a slash, returning an error immediately might create a better UX than accepting it and not working as expected.

Feel free to reopen this or create a new issue titled something along the lines of better feedback for invalid rule creation. Although I can't promise when I'll find free time to work on it, having an open issue might catch someone's eye if they want to open a pull request.