@lvce-editor/extension-search-view 7.29.0 → 7.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4289,6 +4289,10 @@ const getDownloadCount = extension => {
|
|
|
4289
4289
|
return downloadCount.toLocaleString();
|
|
4290
4290
|
};
|
|
4291
4291
|
|
|
4292
|
+
const pathSeparatorRegex = /[\\/]/;
|
|
4293
|
+
const normalizePath = path => {
|
|
4294
|
+
return path.split('/').filter(part => part && part !== '.').join('/');
|
|
4295
|
+
};
|
|
4292
4296
|
const getRemoteUrl = (extension, platform, assetDir) => {
|
|
4293
4297
|
if (extension === null || typeof extension !== 'object') {
|
|
4294
4298
|
return '';
|
|
@@ -4299,9 +4303,12 @@ const getRemoteUrl = (extension, platform, assetDir) => {
|
|
|
4299
4303
|
const path = 'path' in extension && typeof extension.path === 'string' ? extension.path : '';
|
|
4300
4304
|
if (platform === Remote || platform === Electron) {
|
|
4301
4305
|
if (builtin) {
|
|
4302
|
-
|
|
4306
|
+
const directory = path.split(pathSeparatorRegex).findLast(Boolean) || id;
|
|
4307
|
+
return `${assetDir}/extensions/${directory}/${icon}`;
|
|
4303
4308
|
}
|
|
4304
|
-
|
|
4309
|
+
const normalizedPath = normalizePath(path);
|
|
4310
|
+
const normalizedIcon = normalizePath(icon);
|
|
4311
|
+
return `/remote/${[normalizedPath, normalizedIcon].filter(Boolean).join('/')}`; // TODO support windows paths
|
|
4305
4312
|
}
|
|
4306
4313
|
if (platform === Web) {
|
|
4307
4314
|
return `${path}/${icon}`;
|