Page MenuHome GnuPG

Mimetreeparser: Open still does not work correctly
Closed, ResolvedPublic

Description

It always takes the temp file code path since validateFileName returns true for valid file names and the check for that is wrong.

But even then for e.g. a zip file it choses the correct extension but shell execute fails with error 5, which should be permission denied, that confuses me a bit.

[10636] org.kde.pim.mimetreeparser.core: Wrote attachment to file: "C:/Users/Andre Heinecke/AppData/Local/Temp/kleopatraepYeoZ.zip"
[10636] ShellExecute 'file://c/Users/Andre Heinecke/AppData/Local/Temp/kleopatraepYeoZ.zip' failed (error 5).

Revisions and Commits

Event Timeline

aheinecke created this task.

Is executing a zip file really supposed to work on Windows?

Yes and I get the same result with PNG files. But calling shell execute with such an url looks strange to me, I will try QUrl::fromLocalFile as we use in Kleopatra.

Using the codepath where the real filename should be used resulted in the failure that the tempdir was never created, I am changing this now also to use a real QTemporaryDir.

The URL was just wrong for Windows. I added debug output and the results are different:

[4672] org.kde.pim.mimetreeparser.core: Constructed URL is: "file://c/Users/Andre Heinecke/AppData/Local/Temp/kleopatrapmksBM/extensions-before-change.png"
[4672] org.kde.pim.mimetreeparser.core: FromNativeFile URL is: QUrl("file:///C:/Users/Andre Heinecke/AppData/Local/Temp/kleopatrapmksBM/extensions-before-change.png")

I now have a working solution, tested both on Linux and Windows, the only thing that slightly concerns me is how we clean up the temporary dirs on windows which does not purge its temp dir on reboot.

Since I tested this both with valid and invalid filenames on linux and on windows I set this to resolved.