Handle cancel for default download path in Linux sandbox

This commit is contained in:
Ilya Fedin 2022-11-09 19:17:42 +04:00 committed by John Preston
parent 9229c57e7a
commit 0cd0ad7a5b
3 changed files with 3 additions and 0 deletions

View file

@ -195,6 +195,7 @@ QString DefaultDownloadPath(not_null<Main::Session*> session) {
Core::App().saveSettings(); Core::App().saveSettings();
return result; return result;
} }
return QString();
} }
return realDefaultPath; return realDefaultPath;
} }

View file

@ -155,6 +155,7 @@ QString FileNameUnsafe(
return path; return path;
} }
}(); }();
if (path.isEmpty()) return QString();
if (name.isEmpty()) name = qsl(".unknown"); if (name.isEmpty()) name = qsl(".unknown");
if (name.at(0) == QChar::fromLatin1('.')) { if (name.at(0) == QChar::fromLatin1('.')) {
if (!QDir().exists(path)) QDir().mkpath(path); if (!QDir().exists(path)) QDir().mkpath(path);

View file

@ -1750,6 +1750,7 @@ void OverlayWidget::downloadMedia() {
} else { } else {
path = Core::App().settings().downloadPath(); path = Core::App().settings().downloadPath();
} }
if (path.isEmpty()) return;
QString toName; QString toName;
if (_document) { if (_document) {
const auto &location = _document->location(true); const auto &location = _document->location(true);