← All bug reports

FS#1746File > Bitmap Export: File base name cut off in file save dialog

Type
Bug
Status
Closed
Resolution
Fixed
Category
QCAD (main)
Severity
Low
Priority
Low
Reported version
3.20.1
Operating system
All
Reported
2018-04-26 by BlackFox
Closed
2018-04-26 by andrew

A file with name of 1234.56.78.0001.00 Something blah blah.dxf will not export to bitmap correctly. The save dialog will suggest filename of 1234.56.78.0001.jpg instead, truncating everything after last dot.

This bug existed in older versions too because of incorrect handling of file names. As a result, at some point File.getSaveFileName incorrectly truncates the extension (which is empty at the time) and replaces it with jpg. Appending a null extension fixes this, though obviously it's not a correct fix.

Here is a temporary workaround in File.js:

File.getInitialSaveAsPath = function(filePath, extension) {
    var ret = "";

    var fi;

    if (isNull(filePath) || filePath.length === 0) {
        var mdiChild = EAction.getMdiChild();
        var fn;
        if (!isNull(mdiChild)) {
            fn = stripDirtyFlag(EAction.getMdiChild().windowTitle)
        }
        else {
            fn = "File";
        }

        fi = new QFileInfo(QDir.homePath());
        ret = fi.absoluteFilePath() + QDir.separator + fn + "." + extension + ".nothing"; // Workaround here
    } else {
        fi = new QFileInfo(filePath);
        ret = fi.path() + QDir.separator + fi.completeBaseName() + "." + extension + ".nothing"; // Workaround here
    }
    return ret;
};

Comments (4)

andrew 2018-04-26

Are you on the Linux OS?
I can reproduce on Linux / Qt 5.8 only.

BlackFox 2018-04-26

No, I am on Windows (2012 R2), system dialogs off (if I'm not mistaken, not that it should matter?).

The exact order of actions that brings me to this issue is:
1) Open drawing.dxf (any drawing)
2) Press X, B for export bitmap
3) Press enter to accept whatever settings
4) Save dialog shows incorrect filename

andrew 2018-04-26

system dialogs off

Thanks. That seems to be the issue indeed. This looks like a bug in the Qt file dialog which is used when system dialogs are switched off (default under Linux).

andrew 2018-04-26

Also affects File > Advanced SVG Export and other uses of File.getSaveFileName