Commit 108ade3b authored by Jan Paul Batrina's avatar Jan Paul Batrina Committed by Elvis Angelaccio
Browse files

Fix extraction to directories with unicode names when using the Extract file menu

Before this patch, BatchExtract::setDirectory() would ignore directories whose path
contains a tab or an emoji, because QUrl::toDisplayString() returns a percent-encoded name
(regardless of FormattingOption) which does not get percent-decoded.
(see https://stackoverflow.com/questions/24343582/convert-qurl-with-percent-encoding-into-string/24394362#24394362)

We now use QUrl::toLocalFile() instead, which does not percent-encode the name, and we warn the user
if the destination is not local (which is not supported by Ark).

This bug was only present on the extract file menu (via dolphin context menu).

BUG: 408186
FIXED-IN: 20.11.80
parent 635df78f
......@@ -287,22 +287,33 @@ bool BatchExtract::showExtractDialog()
loadJob->start();
}
if (!dialog.data()->exec()) {
if (loadJob) {
loadJob->kill();
loadJob->deleteLater();
QUrl destinationDirectory;
if (dialog.data()->exec()) {
destinationDirectory = dialog.data()->destinationDirectory();
if (destinationDirectory.isLocalFile()) {
setAutoSubfolder(false && dialog.data()->autoSubfolders());
setDestinationFolder(destinationDirectory.toLocalFile());
setOpenDestinationAfterExtraction(dialog.data()->openDestinationAfterExtraction());
setPreservePaths(dialog.data()->preservePaths());
delete dialog.data();
return true;
}
delete dialog.data();
return false;
}
setAutoSubfolder(dialog.data()->autoSubfolders());
setDestinationFolder(dialog.data()->destinationDirectory().toDisplayString(QUrl::PreferLocalFile));
setOpenDestinationAfterExtraction(dialog.data()->openDestinationAfterExtraction());
setPreservePaths(dialog.data()->preservePaths());
// we get here if no directory was chosen, or the chosen directory is not local
if (loadJob) {
loadJob->kill();
loadJob->deleteLater();
}
if (!destinationDirectory.isEmpty() && !destinationDirectory.isLocalFile()) {
KMessageBox::error(nullptr,
xi18nc("@info", "The archive could not be extracted to <filename>%1</filename> because Ark can only extract to local destinations.", destinationDirectory.toDisplayString()));
}
delete dialog.data();
return true;
return false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment