2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Made isAudioFile() check more strictly.

Thanks John Preston.
This commit is contained in:
23rd
2018-11-13 23:32:45 +03:00
committed by John Preston
parent c482ccfd4e
commit 00969df06f

View File

@@ -1292,7 +1292,13 @@ bool DocumentData::isAudioFile() const {
} else if (isSong()) { } else if (isSong()) {
return true; return true;
} }
return _mimeString.startsWith(qstr("audio/"), Qt::CaseInsensitive); const auto prefix = qstr("audio/");
if (!_mimeString.startsWith(prefix, Qt::CaseInsensitive)) {
return false;
}
const auto left = _mimeString.midRef(prefix.size()).toString();
const auto types = { qstr("x-wav"), qstr("wav"), qstr("mp4") };
return ranges::find(types, left) != end(types);
} }
bool DocumentData::isSharedMediaMusic() const { bool DocumentData::isSharedMediaMusic() const {