Skip to content

Commit c25085b

Browse files
committed
Release 20250628-1 [manually done]
1 parent 9c180e6 commit c25085b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

hvdata/appmain.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,17 @@ async function newStorageDir(path) {
106106
}
107107
async function search(filePath, format = STOF_TEXT) {
108108
var fpath = `${storageO}/${filePath}`;
109+
const doubleSlash = '//';
110+
const doubleSlashIndexLast = fpath.lastIndexOf(doubleSlash);
111+
const doubleSlashIndex = fpath.indexOf(doubleSlash);
109112

110-
if (fpath.startsWith('http') || fpath.startsWith('ftp'))
111-
fpath = fpath.replace('//', '/');
112-
else
113-
fpath = fpath.replace('//', '/_base/');
113+
if (doubleSlashIndexLast != doubleSlashIndex && doubleSlashIndex >= 0 && doubleSlashIndexLast >= 0) {
114+
var replacement = '/_base/';
115+
if (fpath.startsWith('http') || fpath.startsWith('ftp'))
116+
replacement = '/';
117+
118+
fpath = fpath.slice(0, doubleSlashIndexLast) + replacement + fpath.slice(doubleSlashIndexLast + 2);
119+
}
114120

115121
const response = await fetchDataOrEmpty(fpath);
116122

0 commit comments

Comments
 (0)