fix: secure blobs (#10490)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2026-02-09 09:22:27 +07:00
committed by GitHub
parent 78bf4743c9
commit 7b133e084d
9 changed files with 86 additions and 14 deletions
+12 -8
View File
@@ -891,15 +891,19 @@ export function isSpaceClass (_class: Ref<Class<Doc>>): boolean {
}
export function setPresentationCookie (token: string, workspaceUuid: WorkspaceUuid): void {
function setToken (path: string): void {
const res =
encodeURIComponent(plugin.metadata.Token.replaceAll(':', '-')) +
'=' +
encodeURIComponent(token) +
`; path=${path}`
document.cookie = res
const cookieName = encodeURIComponent(plugin.metadata.Token.replaceAll(':', '-'))
const cookieValue = encodeURIComponent(token)
const storage = getMetadata(plugin.metadata.FileStorage)
if (storage !== undefined) {
let path = `/files/${workspaceUuid}`
try {
path = storage.getCookiePath(workspaceUuid)
} catch {}
const normalized = path.startsWith('/') ? path : `/${path}`
document.cookie = `${cookieName}=${cookieValue}; path=${normalized}`
}
setToken('/files/' + workspaceUuid)
}
export const upgradeDownloadProgress = writable(-1)