summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
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();