aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/module-fs.js')
-rw-r--r--modules/core/module-fs.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/core/module-fs.js b/modules/core/module-fs.js
index d94feb8..2b525f0 100644
--- a/modules/core/module-fs.js
+++ b/modules/core/module-fs.js
@@ -447,7 +447,15 @@ class FileSystemModule {
const baseUrl = wdav.config.url.replace(/\/+$/, '');
const hostMatch = baseUrl.match(/^(https?:\/\/[^\/]+)/);
const host = hostMatch ? hostMatch[1] : 'https://webx11.duckdns.org';
- downloadUrl = host + '/spaces/' + wdav._spaceName + '/downloads/' + encodeURIComponent(fname);
+ // Build the public URL the user can tap.
+ // The URL must use the space the PUT actually went to
+ // (config.url = the logged-in user's space). _spaceName is
+ // derived from the page path (/spaces/newos4/…) and is wrong
+ // for users downloading into their own space (2026-10-21).
+ const urlSpace = (typeof wdav._resolveSpaceName === 'function' && wdav._resolveSpaceName()) ||
+ (wdav._extractSpaceNameFromUrl && wdav._extractSpaceNameFromUrl(wdav.config.url)) ||
+ wdav._spaceName;
+ downloadUrl = host + '/spaces/' + urlSpace + '/downloads/' + encodeURIComponent(fname);
this.terminal.print('Uploaded to: ' + downloadUrl, 'success');
} else {
this.terminal.print('WebDAV push failed: HTTP ' + resp.status, 'warning');