2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 07:56:03 +00:00

Showing in folder instead of launching media files with bad extensions.

Thanks for the report to: Sadegh Ahmadzadegan - Omid Ghaffarinia.
This commit is contained in:
John Preston
2016-06-29 18:21:21 +03:00
parent da293755ef
commit 8909943bd3
4 changed files with 44 additions and 6 deletions

View File

@@ -975,8 +975,13 @@ void DocumentOpenClickHandler::doOpen(DocumentData *data, ActionOnLoad action) {
audioPlayer()->play(song);
if (App::main()) App::main()->documentPlayProgress(song);
}
} else if (data->voice() || data->isVideo()) {
psOpenFile(location.name());
} else if (data->voice() || data->song() || data->isVideo()) {
auto filepath = location.name();
if (documentIsValidMediaFile(filepath)) {
psOpenFile(filepath);
} else {
psShowInFolder(filepath);
}
if (App::main()) App::main()->mediaMarkRead(data);
} else if (data->size < MediaViewImageSizeLimit) {
if (!data->data().isEmpty() && playAnimation) {
@@ -1270,8 +1275,12 @@ void DocumentData::performActionOnLoad() {
psOpenFile(already, true);
}
} else if (_actionOnLoad == ActionOnLoadOpen || _actionOnLoad == ActionOnLoadPlayInline) {
if (voice() || isVideo()) {
psOpenFile(already);
if (voice() || song() || isVideo()) {
if (documentIsValidMediaFile(already)) {
psOpenFile(already);
} else {
psShowInFolder(already);
}
if (App::main()) App::main()->mediaMarkRead(this);
} else if (loc.accessEnable()) {
if (showImage && QImageReader(loc.name()).canRead()) {