summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-04-09 11:13:35 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-04-09 11:13:35 +0300
commitbcc64101562cb85de532cd03cfb19b0cfb90af8b (patch)
tree11ce52180a001637aed798f0365c71748cfc1d8f /plugins
parent102ceb42c38c52155e810fd96f8987e81c5dc8be (diff)
fixes #4339 (Telegram: скачанный облачный файл не удаляется, когда удаление инициировано сервером)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/src/webpage.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/NewStory/src/webpage.cpp b/plugins/NewStory/src/webpage.cpp
index a85d0587a9..376a59b1f0 100644
--- a/plugins/NewStory/src/webpage.cpp
+++ b/plugins/NewStory/src/webpage.cpp
@@ -663,7 +663,13 @@ uint_ptr NSWebPage::get_image(LPCWSTR url_or_path, bool)
if (!mir_wstrncmp(url_or_path, L"file://", 7))
url_or_path += 7;
- auto *pImage = new Gdiplus::Bitmap(url_or_path);
+ IStream *pStream = 0;
+ HRESULT hr = SHCreateStreamOnFileEx(url_or_path, STGM_READ | STGM_SHARE_DENY_NONE, 0, FALSE, 0, &pStream);
+ if (!SUCCEEDED(hr))
+ return 0;
+
+ auto *pImage = new Gdiplus::Bitmap(pStream);
+ pStream->Release();
if (pImage->GetLastStatus() != Ok) {
delete pImage;
return 0;