mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 04:07:43 +02:00
fix: secure blobs (#10490)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user