mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 15:35:51 +00:00
Detect file mime from content as well on Linux.
This commit is contained in:
@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "platform/platform_file_utilities.h"
|
#include "platform/platform_file_utilities.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
|
#include "base/platform/base_platform_file_utilities.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/view/media/history_view_gif.h"
|
#include "history/view/media/history_view_gif.h"
|
||||||
@@ -1714,10 +1715,16 @@ bool IsIpRevealingName(const QString &filepath) {
|
|||||||
const auto list = joined.split(' ');
|
const auto list = joined.split(' ');
|
||||||
return base::flat_set<QString>(list.begin(), list.end());
|
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(
|
return ranges::binary_search(
|
||||||
kExtensions,
|
kExtensions,
|
||||||
FileExtension(filepath).toLower());
|
FileExtension(filepath).toLower()
|
||||||
|
) || base::Platform::IsNonExtensionMimeFrom(filepath, kMimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::binary_guard ReadImageAsync(
|
base::binary_guard ReadImageAsync(
|
||||||
|
Reference in New Issue
Block a user