summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-04 17:16:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-04 17:16:24 +0300
commit98786d882525db4b506eddb011901c60d51857ac (patch)
tree1ab15ac0c2a620cab6cce606c861e01cffc67825 /plugins/NewStory/src/history_array.cpp
parentf57c708e91b580c3f03eceb137be435538432f7b (diff)
fixes #3380 (NewStory: некорректно парсится пробел в пути к файлу)
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 6247e22cab..6b64e08c63 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -129,6 +129,16 @@ void ItemData::load(bool bFullLoad)
{
CMStringW wszFileName(buf);
wszFileName.Append(ptrW(DbEvent_GetTextW(&dbe, CP_ACP)));
+
+ // if a filename contains spaces, URL will be broken
+ if (wszFileName.Find(' ') != -1) {
+ wchar_t wszShortPath[MAX_PATH];
+ if (GetShortPathNameW(wszFileName, wszShortPath, _countof(wszShortPath))) {
+ wszFileName = wszShortPath;
+ wszFileName.MakeLower();
+ }
+ }
+
wszFileName.Replace('\\', '/');
wszFileName.Insert(0, L"file://");
wtext = wszFileName.Detach();