Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
fixed file url issue #1054
left a comment
This change worked for me.
However, space is not the only character that needs to be urlencoded (as mentioned in your screenshot). e.g.
Also, I suggest you add the text in your screenshot to either the commit message or the PR comment section.
I'm not sure what is happening, but my comments in the review are
The reason for replacing a
I believe some wikis do the same. confluence maybe?
@tessus you are absolutely right! The ' (single quote) is a problem. So far I have not find another critical character, but I will have a closer look soon.
Yes and no. The
If a file really had a
P.S.: The chance of having a space in a filename is much higher than having a
There are a lot of rather heated discussions revolving around the subject of using the plus sign in URLs.
The best description I could find is
There is no query part in file-URLs, using the '+' in the path section to represent space is maybe not a good idea.
All non US-ASCII characters has to be percent encoded. All unreserved US-ASCII characters can and should be used unescaped: ALPHA / DIGIT / "-" / "." / "_" / "~"
There are a couple of reserved characters in RFC3986. These are ":" / "/" / "?" / "#" / "[" / "]" / "@""!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
But given the fact that we don't have/need delimiters in file-URLs these characters can be (and for the sake of readability in my opinion should be) used unescaped.
As a side note:
An easy way to get a well defined file-URL reference of a file is by creating a context menu extension of your file browser. I defined mine in MAC-OS finder with the help of a script I found in https://stackoverflow.com/questions/9617029/how-to-get-the-a-file-url-in-osx-with-applescript-or-a-shell-script.
EDIT: A very interesting file URL blog entry from Microsoft can be found in https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/. Especially the proposed handling of non US-ASCII characters is different in Microsoft. They suggest leaving non US-ASCII characters untouched, replacing only the spaces with %20. A file-URL extension for Microsoft Explorer can be found in https://superuser.com/questions/297060/generate-file-uris-in-windows-explorer (I have not tried it yet)
Is it possible to slightly alter the drag and drop mechanism of joplin to enable the choice of either embedding the file or inserting a file-url instead?
Well, I think it's @laurent22's decision alone. I'm not a developer of Joplin and it's his code.
I like this idea, maybe by clicking