diff --git a/server.mjs b/server.mjs index 9e4c168..794840c 100644 --- a/server.mjs +++ b/server.mjs @@ -31,7 +31,7 @@ import { } from './user-auth.mjs'; import { createWikiAuth } from './wiki-auth.mjs'; import { isLocalDevHostname } from './scripts/local-test-config.mjs'; -import { PUBLISH_ROOT_DIR, PUBLISH_KEY_UUID, PUBLIC_ZONE_DIR, resolvePublishDir, resolvePublicBaseUrl } from './user-publish.mjs'; +import { buildPublicUrl, PUBLISH_ROOT_DIR, PUBLISH_KEY_UUID, PUBLIC_ZONE_DIR, resolvePublishDir, resolvePublicBaseUrl } from './user-publish.mjs'; import { ensureWorkspaceHtmlThumbnail, startWorkspaceThumbnailWatcher, workspaceThumbnailRelativePath } from './mindspace-workspace-thumbnails.mjs'; import { startWorkspaceAssetSyncWatcher } from './mindspace-workspace-sync.mjs'; import { attachRequestId, sendData, sendError } from './api-response.mjs'; @@ -3125,7 +3125,7 @@ api.post('/mindspace/v1/pages/quick-share-from-chat', async (req, res) => { await fsPromises.writeFile(destPath, sharedHtml, 'utf8'); const publishKey = req.currentUser.id; - const publicUrl = `${resolvePublicBaseUrl()}/${PUBLISH_ROOT_DIR}/${encodeURIComponent(publishKey)}/${sharedRelativePath.split('/').map((part) => encodeURIComponent(part)).join('/')}`; + const publicUrl = buildPublicUrl(resolvePublicBaseUrl(), publishKey, sharedRelativePath); return res.status(201).json({ data: { publicUrl, filename } }); } catch (error) {