mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Detect file mime from content as well on Linux.
This commit is contained in:
parent
7dabcf5a32
commit
b5a2b0fb98
1 changed files with 8 additions and 1 deletions
|
@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
#include "platform/platform_file_utilities.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/base_platform_file_utilities.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/view/media/history_view_gif.h"
|
||||
|
@ -1714,10 +1715,16 @@ bool IsIpRevealingName(const QString &filepath) {
|
|||
const auto list = joined.split(' ');
|
||||
return base::flat_set<QString>(list.begin(), list.end());
|
||||
}();
|
||||
static const auto kMimeTypes = [] {
|
||||
const auto joined = u"text/html image/svg+xml"_q;
|
||||
const auto list = joined.split(' ');
|
||||
return base::flat_set<QString>(list.begin(), list.end());
|
||||
}();
|
||||
|
||||
return ranges::binary_search(
|
||||
kExtensions,
|
||||
FileExtension(filepath).toLower());
|
||||
FileExtension(filepath).toLower()
|
||||
) || base::Platform::IsNonExtensionMimeFrom(filepath, kMimeTypes);
|
||||
}
|
||||
|
||||
base::binary_guard ReadImageAsync(
|
||||
|
|
Loading…
Add table
Reference in a new issue