1

I have created new protocol handler for opening application through web pages where a link will open installed application like terminal/chrome etc as suggested in: (Is it possible to open an Ubuntu app from HTML?) , in my case its nautilus file browser.. worked perfectly w/o any arguments, however when I pass arguments like 'app://nautilus /home/user/dir/my dir/' (argument has space in it, it fails even tried escape sequence ('\') for space, no luck.

Here, I am trying to open directories in random sequence where I cannot create symbolic link for each of directories. Can some one help me how to pass arguments which has spaces to new created protocol ?

any help appreciated, thanks in advance.

tried creating a shell script test.sh which has just nautilus $@ , and nautilus "$@" and ran test.sh "/home/usr/dir/my\ dir" and all above combination, but no luck

Mahesh S
  • 41
  • 4

1 Answers1

1

You need to put that part in between "'s. So that would be

"app://nautilus /home/user/dir/my dir/"

That is a common method when dealing with spaces and parameters.

Alternative: html uses url encoding. A space would then become a %20:

app://nautilus%20/home/user/dir/my%20dir/
Rinzwind
  • 299,756
  • I tried many combination "app://nautilus /home/user/dir/my dir/" "app://nautilus /home/user/dir/my\ dir/" "app://nautilus" /home/user/dir/my dir/ app://nautilus /home/user/dir/my dir/, it just treat as different path/directory – Mahesh S Nov 28 '13 at 08:50
  • Maybe worth a shot: try %20 as a space :) If those 2 do not work I would consider filing a bug. – Rinzwind Nov 28 '13 at 09:00
  • yeah tried, %20, single colon around whole, '' before space, "app://nautilus\ /home/user/dir/my\ dir/", "app://nautilus /home/user/dir/my%20dir/", app://nautilus "/home/user/dir/my%20dir/" no luck. may not be bug I believe some where something goofed up - well symbolic links to those folders (which has space in it) works perfectly which is not an option for me :( – Mahesh S Nov 28 '13 at 09:16
  • app://nautilus%20/home/user/dir/my%20dir/ whole will be treated as application and returns command not found from xdg-open – Mahesh S Nov 28 '13 at 09:21
  • Thank you Rinzwind, I found solution, its the argument in which we were passing to protocol handler. small modification in shell script, we need to put "'s in protocol handler rather in php/html and removed all escape chars since we are using "'s. – Mahesh S Nov 29 '13 at 05:26