Open files with missing extension

• Apr 20, 2010 - 00:37
Type
Functional
Frequency
Once
Severity
S4 - Minor
Status
active
Regression
No
Workaround
No
Project
Tags

When trying to "File->Open..." the following URL:
http://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/bach/cello…
in MuseScore 0.9.5, I get a blank page.

However, when this webpage is saved to the local hard disk (in a file named bwv1007-01.xml), the file opens as expected in MuseScore.

Probably the "?" and "&" are causing problems. Maybe the "?" is being encoded as "%3F" and "&" as "%26", and they are therefore losing their special function in URL addresses.

MusicXML files in regular URL's do not have a problem loading directly from the address, such as:
http://253.ccarh.org/lab/musescore/ex1/musescore1-output.xml


Comments

The "?" and "&" are irrelevant. The problem is that the file does not have a .xml file extension so MuseScore does not recognize it as MusicXML.

Here's how I came to that conclusion:

  1. I started Notepad++
  2. File > Open
  3. Into the Open dialog paste: http://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/bach/cello…
  4. File > Save As (do not change the file name)
  5. Start MuseScore and open the file you saved in step 4 above. Notice that the score appears blank
  6. Add ".xml' to the end of the file name you created in step 4
  7. Open the file you renamed in step 6 above. Notice that the score appears with all the notation

Since no user data is lost or corrupted by this issue, a simple workaround exists, and the problem is unlikely to be encountered by most users, I downgraded the priority.

Hmmm.... There is a filename present in the HTTP reply header which could be used. I am looking in the Qt documentation to see how it might be accessed: maybe useful functions for accessing the filename in these cases (explained more below) might help: QNetworkReply::header(), QNetworkReply::hasRawHeader(), QNetworkReply::rawHeader(), QNetworkReply::rawHeaderList(), QNetworkReply::rawHeaderPairs():
http://doc.trolltech.com/main-snapshot/qnetworkreply.html

Here is a demonstration of how you can see the filename from a web browser. If you open the link (at least in FireFox):
http://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/bach/cello…
And then choose: "Save Page As...", a file saving window comes up with the name of the file, bwv1007-01.xml.

The filename is stored in the HTTP reply header which can be seen with this command in linux:
wget --save-headers 'http://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/bach/cello…' -O test.xml

The first few lines of test.xml will have the HTTP reply header:

HTTP/1.1 200 OK
Date: Tue, 20 Apr 2010 03:45:59 GMT
Server: Apache
Content-Disposition: inline; filename="bwv1007-01.xml"
Connection: close
Content-Type: text/xml

And the line starting with "Content-Disposition" contains a field for the intended filename for the data which follows.

It's a Qt bug/missing feature I'm afraid. The QFileDialog accepts an URL and send back the tmp file name created after download. Apparently the Content-Disposition parameter is not honored during the download on Windows. It might even be a limitation of the Open dialog on windows?