After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 429107 - Beagle-live error when trying to open files or folders
Beagle-live error when trying to open files or folders
Status: RESOLVED FIXED
Product: deskbar-applet
Classification: Deprecated
Component: general
2.18.x
Other All
: Normal normal
: ---
Assigned To: Deskbar Applet Maintainer(s)
Deskbar Applet Maintainer(s)
: 411209 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-04-12 19:53 UTC by Xitij Ritesh Patel
Modified: 2007-09-27 09:48 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18



Description Xitij Ritesh Patel 2007-04-12 19:53:21 UTC
Please describe the problem:
When I use the deskbar-applet Beagle Live handler, search results return fine. The trouble is when I try to open a file or folder. When I try to open a folder, it returns this error: Couldn't find "/file:/home/xitij/School". Please check the spelling and try again. When I try to open a file 'q.pdf', it returns: Cannot show URL: 'file://file%3A///home/xitij/School/3A%2520Work%2520Term%2520Report'.

Note that Beagle's own search tool works perfectly fine.

Steps to reproduce:
1. Enter a query for a file or folder.
2. Click the returned result.


Actual results:
An error message as described above.

Expected results:
For it to actually open the file or folder.

Does this happen every time?
Yes.

Other information:
I've isolated this issue down to Lines 104 to 112 in beagle-live.py in /usr/lib/deskbar-applet/handlers/. 

	"File" 		: {
		"name"	: ("beagle:ExactFilename",), 
		"action": lambda d: url_show_file("file://"+d["uri"]),
		"icon"	: "stock_new",
		#translators: This is a file.
		"description": _("Open %s") % "<b>%(name)s</b>",
		"snippet": True,
		"category": "files",
		},

The 3rd line above, where the string 'file://' is pre-pended to the search result seems to be the issue. I tried removing this string, but then got the error: Cannot execute program '/path/to/the/(The file I wanted)'. Same for folders.

Please fix this ASAP, I really love using this tool. It's useless to me without this now.
Comment 1 Mikkel Kamstrup Erlandsen 2007-04-19 20:52:09 UTC
This was caused by http://svn.gnome.org/viewcvs/deskbar-applet/trunk/deskbar/handlers/beagle-live.py?r1=1109&r2=1178

I'm looking into it
Comment 2 Mikkel Kamstrup Erlandsen 2007-04-19 20:53:51 UTC
The patch above was applied to fix bug 411209 btw
Comment 3 thomas.goose 2007-05-13 09:59:59 UTC
I suppose you already know this, but I thought I'd mention that as with the previous bug I think this only applies to filenames with spaces in.
Comment 4 Luke Tilley 2007-05-14 18:07:02 UTC
i've narrowed down the problem and sort of fixed it as well. The problem seems to lie in the Utils.py file in the url_show_file(url) function. It seems that even if you put url_show_file(d["uri"]) instead of url_show_file("file://"+d["uri"]) the file:// prefix is added therefore in Utils.py, line 125 is not needed and you can simply pass 'url' into gnomevfs.url_show()
Comment 5 Rüdiger Diedrich 2007-06-07 18:19:47 UTC
Based on Luke's idea, changing:

url_show_file("file://"+d["uri"])

to:

url_show(d["uri"])

seems to fix the issue.
I've tested file names containing spaces as well as file names containing unicode characters and it worked for me®
Comment 6 Iain Nicol 2007-06-13 12:01:21 UTC
*** Bug 411209 has been marked as a duplicate of this bug. ***
Comment 7 Iain Nicol 2007-06-13 12:19:23 UTC
Rüdiger's fix works--at least for now--but I don't think it should be used. Let me elaborate.

Firstly, I suggested adding the "file://" to fix Bug 411209. Either I'm mad, or at the time, d["uri"] didn't include "file://". Anyway, now ["uri"] does include "file://", which I guess might be due to a change in Beagle's behaviour (?).

The current problem with d["uri"] is that it's URL-encoded, which I'm guessing it shouldn't be, as there's also the parameter d["escaped_uri"]. You can verify that uri is URL-encoded in beagle-live.py by changing the file open function to:

def url_log_file(d):
	f = open("beaglelog", "a")
	f.write("%s\n" % (d["uri"],))
	f.close()

So, I recommend using escaped_uri instead of uri, because it's clear that it's escaped. If we were to use uri and it isn't meant to be escaped, some bug fix later might cause it to be unescaped, causing problems here again.

Secondly, there's an advantage to using url_show_file as opposed to url_show: the file gets added to the recent files list. We can't use url_show_file as is, though, because it expects an unescaped URL. So in comments 3 and 4 of Bug 411209, I suggested the ugly fix of adding an extra parameter to url_show_file, indicating whether the URL's escaped.

I'll repost it here for your convenience:

In beagle-live.py, change the action to:
"action": lambda d: url_show_file(d["escaped_uri"], escaped=True)

And in Utils.py, the beginning of url_show_file should be:
def url_show_file(url, escaped=False):
        try:
                if escaped:
                        uri = url
                else:
                        uri = gnomevfs.escape_host_and_path_string(url)
                gnomevfs.url_show(uri)
Comment 8 Luke Macken 2007-07-15 23:11:54 UTC
Just a side note, I threw together a patch based on Iain Nicol's advice in Comment #7 for Fedora, which seemed to do the trick, and pushed a new version of deskbar-applet to our devel tree.

http://cvs.fedora.redhat.com/viewcvs/rpms/deskbar-applet/devel/deskbar-applet-beagle-live.patch?rev=1.1&view=auto
Comment 9 Sebastian Pölsterl 2007-08-18 19:47:50 UTC
Without knowing that this bug existed I did exactly what Iain Nicol did. In addition, I fixed several bugs in beagle-live for 2.19.91.