File Names & Corrupt File Error

• Sep 6, 2021 - 21:51
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
Yes
Project

1) Save a score with an upper case file extension (i.e.: .MSCZ).

2) Open MuseScore, and then attempt to open the score that has been saved with an upper case file extension.

You get this error:

ErrorDialog.png

If you choose [Ignore], you get an empty workspace.

Merely renaming the file with a lower case extension cures the problem.


Comments

Frequency Many Once
Severity S3 - Major S2 - Critical
Workaround No Yes

You're all but one, crashes and corruptions are critical, there's a (rather easy) workaround.

I still dont understand how you save a score with an upper case extension. I tried it and could not make it happen.
If I open a score in MuseScopre 3.6.2 on Wondows 10, go to File > Save as and in that dialog change to another directory, then change the ".mscz" to ".MSCZ" and hit "Save", the score does not get saved at all!

Only way I gould reproduce it it by using Windows WExplorer to rename the file.
Anyway, the fix is a simple one-liner for 3.x:

diff --git a/libmscore/scorefile.cpp b/libmscore/scorefile.cpp
index d40840adf..fd8c3f42c 100644
--- a/libmscore/scorefile.cpp
+++ b/libmscore/scorefile.cpp
@@ -942,7 +942,7 @@ Score::FileError MasterScore::loadMsc(QString name, QIODevice* io, bool ignoreVe
       ScoreLoad sl;
       fileInfo()->setFile(name);
 
-      if (name.endsWith(".mscz") || name.endsWith(".mscz,"))
+      if (name.endsWith(".mscz", Qt::CaseInsensitive) || name.endsWith(".mscz,", Qt::CaseInsensitive))
             return loadCompressedMsc(io, ignoreVersionError);
       else {
             XmlReader r(io);

but quite a bit more involved for master AKA 4.x

Regression No Yes

FWIW: Works just fine with MuseScore 1.3, no error message with MuseScore 2.(0.0 - .2.3) but shows as an empty score, so this seems to be a regression since 2.0, with the slight improvement in 3.x to warn about the corruption.

Reported version 3.6  

It seems that really only the extensions .MSCZ and .MSCZ, (backup file) are affected by that, .MSCX, .MSCX, (backup file) and .XML, .MUSICXML, .MXL as well as the GuitarPro extensions (which use the same code as the one liner above already) all work properly.

Fix version
4.0.0