andy-portmen / open-in

Send URLs from one browser to another one
http://add0n.com/open-in.html
172 stars 113 forks source link

# in URL breaks pattern matching in Reverse Mode #66

Closed dyspr0sium closed 2 years ago

dyspr0sium commented 2 years ago

In the Chrome version of Open In Firefox, I have the following set for the list of domains:

meet.google.com, chat.google.com

with Reverse Mode ticked. This should mean that any links matching those two domains should open in Chrome, and anything else should open in Firefox.

This works well, opening all other links in Firefox as intended, but if there is a # in the link, then the link incorrectly opens in Chrome.

E.g. https://docs.python.org/3.8/library/typing.html -> opens correctly in Firefox https://docs.python.org/3.8/library/typing.html#typing.Literal -> opens incorrectly in Chrome

http://kieranwynn.github.io/pyquaternion -> opens correctly in Firefox http://kieranwynn.github.io/pyquaternion/#object-initialisation -> opens incorrectly in Chrome

This issue only occurs in Reverse Mode; in normal mode URLs in the list of domain with or without # are correctly opened in Firefox.

dyspr0sium commented 2 years ago

Looks like this behaviour might be caused by the following line: https://github.com/andy-portmen/open-in/blob/0e675573baa95be3ea9999a1ea1a6f9e490e3a20/common/data/inject.js#L34 In Reverse Mode, the code is explicitly checking that # is not in the hyperlink. I'm sure there was a good reason to do so, but I'm not sure what it was and whether it can be differentiated from the cases in my examples where you would want the links to work normally. Should be an easy fix @andy-portmen

HenryTheVacuum commented 2 years ago

Can confirm having this issue.

andy-portmen commented 2 years ago

Thanks for the report. Should be fixed by the next release;

https://github.com/andy-portmen/open-in-firefox/blob/master/v3/data/inject.js#L54-L61

dyspr0sium commented 2 years ago

I can confirm that this issue is solved on Open In Firefox 0.4.1. Thanks for the quick fix Andy.