GNOME Bugzilla – Bug 322799
Filenames containing a colon (e.g. foo:bar.gnumeric) results in "Invalid URI"
Last modified: 2005-12-02 17:54:19 UTC
Please describe the problem: When opening a file containing a colon in its filename (e.g. e:1.25_r:11_h:v.gnumeric) from the command line (e.g. "gnumeric e:1.25_r:11_h:v.gnumeric"), one only gets an error stating "Invalid URI", not the file. Gnumeric then proceeds to open a new workbook, not the requested workbook, and one must select the file from the file chooser. Steps to reproduce: 1. Create file containing a colon in its name 2. Start gnumeric with it as an argument 3. Cry over "distinct lack of joy" Actual results: What actually happens when I follow these steps: misery, and maybe poverty, if my time is truly worth money as They claim. Expected results: I expect gnumeric to open the spreadsheet. Does this happen every time? Yes. Other information: Workaround: open the file with the following command: gnumeric file://`pwd`/file:containing:colons.gnumeric and it will open fine.
Thinking about the security ramifications of URIs and filename conflicts, I recommend the following course of action regarding URIs: 1) If a parameter passed as a potential URI contains a colon, check to see if it's a valid URI 2) If a valid URI, check to see if a file exists with the specified name. I) If no such file exists, use it as a URI II) If such a file exists, alert the user and ask him/her what to do. 3) If NOT a valid URI, it's a filename.
We currently just use gnome-vfs's function for this. The problem is that it is designed for general URLs, not just the protocols that gnome-vfs can handle. URLs can be very, very general. We cannot rely on user interaction. This has to work for the command line too. I do not think we want to test for file existance. It would work for the read side, but not for the write side. That would be very confusing.
Fixed in goffice cvs. Just don't put files into directories named "http:" or "ftp:". In that case, you get what you deserve.