Suppose I have a file ~/Desktop/foo:bar.webloc
.
(a) If I double-click it, it opens a particular web page. Great!
(b) If in the Terminal I run open ~/Desktop/foo:bar.webloc
, it opens the webpage. Great!
(c) If in the Terminal I run cd Desktop
and then open foo:bar.webloc
, I am greeted with
% open foo:bar.webloc
foo:bar.webloc?
[0] cancel
[1] Open the file foo:bar.webloc
[2] Open the URL foo:bar.webloc
Which did you mean?
I'm guessing that open
thinks that the filename might be a URL. Is there some way to force open
to open the file by default if the file exists, even if the file name matches a pattern that could conceivably be a URL? Kind of the opposite of open -u
? Do I just need to avoid colons in filenames?
This arose because Firefox created a filename containing a colon when I dragged from the URL bar to the desktop, and then I tried to open it from the Terminal. Maybe another question is: is there a way to automatically get colon-free filenames when creating webloc files? (If you want to test, you can use the URL https://github.com/sagemath/trac-to-github/blob/master/docs/Migration-Trac-to-Github.md. Safari and Chrome produce colon-free filenames, but not Firefox.)
Edit: based on case (b), a partial workaround is to use open ./foo:bar.webloc
.