flathub / io.typora.Typora

https://flathub.org/apps/details/io.typora.Typora
3 stars 5 forks source link

Fails to open file if directory contains spaces #4

Closed LeonStaufer closed 3 years ago

LeonStaufer commented 3 years ago

Typora is unable to open files by double-clicking if the directory containing it has spaces in its name. This problem does not occur with other programs or when starting Typora from the command line. Related to the original issue in the Typora repo.

Error: Failed to load file: ENOENT: no such file or directory, open ...

Version 0.10.3 (beta) on Fedora 33.20210421.0 (Silverblue).

LeonStaufer commented 3 years ago

I think this is because file URLs need to be quoted if they contain spaces or special characters.

Changing the following to Exec=typora '%U' might solve the problem. https://github.com/flathub/io.typora.Typora/blob/6fdd2c0bc8ccbdeda4b8dc6fcb3e8d58640677a4/io.typora.Typora.desktop#L5

LeonStaufer commented 3 years ago

Okay, I'm sorry. I've just rebuilt the Typora Flatpak with the test release and the issue still occurs :/

The following is the .desktop file created by Flatpak:

[Desktop Entry]
Name=Typora
Comment=A minimal Markdown reading & writing app. Change Log: (https://typora.io/windows/dev_release.html)
GenericName=Markdown Editor
Exec=/usr/bin/flatpak run --branch=master --arch=x86_64 --command=typora --file-forwarding io.typora.Typora @@u %U @@
Icon=io.typora.Typora
Type=Application
StartupNotify=true
Categories=Office;WordProcessor;
MimeType=text/markdown;text/x-markdown;
Actions=new-window
X-Flatpak=io.typora.Typora

[Desktop Action new-window]
Name=Open a new Window
Exec=/usr/bin/flatpak run --branch=master --arch=x86_64 --command=typora io.typora.Typora

So it seems, that quotes actually have no effect.

Apologies for submitting the PR early. In fact, my proposed solution of quoting the field character %U is discouraged. If you have any ideas how this could be fixed, please let me know.