mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
fix: URI encode datalake blob id and more workspace fixes (#6449)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
202adb5077
commit
15028992d6
@ -21,7 +21,7 @@ import presentation from './plugin'
|
|||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export function getCollaboratorClient (): CollaboratorClient {
|
export function getCollaboratorClient (): CollaboratorClient {
|
||||||
const workspaceId = getWorkspaceId(getMetadata(presentation.metadata.Workspace) ?? '')
|
const workspaceId = getWorkspaceId(getMetadata(presentation.metadata.WorkspaceId) ?? '')
|
||||||
const token = getMetadata(presentation.metadata.Token) ?? ''
|
const token = getMetadata(presentation.metadata.Token) ?? ''
|
||||||
const collaboratorURL = getMetadata(presentation.metadata.CollaboratorUrl) ?? ''
|
const collaboratorURL = getMetadata(presentation.metadata.CollaboratorUrl) ?? ''
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ function clearMetadata (ws: string): void {
|
|||||||
delete tokens[loc.path[1]]
|
delete tokens[loc.path[1]]
|
||||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||||
}
|
}
|
||||||
const currentWorkspace = getMetadata(presentation.metadata.Workspace)
|
const currentWorkspace = getMetadata(presentation.metadata.WorkspaceId)
|
||||||
if (currentWorkspace !== undefined) {
|
if (currentWorkspace !== undefined) {
|
||||||
setPresentationCookie('', currentWorkspace)
|
setPresentationCookie('', currentWorkspace)
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ export class IndexeddbProvider extends IndexeddbPersistence implements Provider
|
|||||||
readonly awareness: Awareness | null = null
|
readonly awareness: Awareness | null = null
|
||||||
|
|
||||||
constructor (documentId: string, doc: YDoc) {
|
constructor (documentId: string, doc: YDoc) {
|
||||||
const workspaceId: string = getMetadata(presentation.metadata.Workspace) ?? ''
|
const workspaceId: string = getMetadata(presentation.metadata.WorkspaceId) ?? ''
|
||||||
|
|
||||||
const name = `${workspaceId}/${documentId}`
|
const name = `${workspaceId}/${documentId}`
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import { IndexeddbProvider } from './indexeddb'
|
|||||||
import { type Provider } from './types'
|
import { type Provider } from './types'
|
||||||
|
|
||||||
export function formatCollaborativeDocumentId (collaborativeDoc: CollaborativeDoc): DocumentId {
|
export function formatCollaborativeDocumentId (collaborativeDoc: CollaborativeDoc): DocumentId {
|
||||||
const workspace = getMetadata(presentation.metadata.Workspace) ?? ''
|
const workspace = getMetadata(presentation.metadata.WorkspaceId) ?? ''
|
||||||
return formatDocumentId(workspace, collaborativeDoc)
|
return formatDocumentId(workspace, collaborativeDoc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ function clearMetadata (ws: string): void {
|
|||||||
delete tokens[loc.path[1]]
|
delete tokens[loc.path[1]]
|
||||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||||
}
|
}
|
||||||
const currentWorkspace = getMetadata(presentation.metadata.Workspace)
|
const currentWorkspace = getMetadata(presentation.metadata.WorkspaceId)
|
||||||
if (currentWorkspace !== undefined) {
|
if (currentWorkspace !== undefined) {
|
||||||
setPresentationCookie('', currentWorkspace)
|
setPresentationCookie('', currentWorkspace)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export class AuthenticationExtension implements Extension {
|
|||||||
const workspaceInfo = await getWorkspaceInfo(data.token)
|
const workspaceInfo = await getWorkspaceInfo(data.token)
|
||||||
|
|
||||||
// verify workspace url in the document matches the token
|
// verify workspace url in the document matches the token
|
||||||
if (workspaceInfo.workspace !== workspaceId) {
|
if (workspaceInfo.workspaceId !== workspaceId) {
|
||||||
throw new Error('documentName must include workspace id')
|
throw new Error('documentName must include workspace id')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ export class Client {
|
|||||||
constructor (private readonly endpoint: string) {}
|
constructor (private readonly endpoint: string) {}
|
||||||
|
|
||||||
getObjectUrl (ctx: MeasureContext, workspace: WorkspaceId, objectName: string): string {
|
getObjectUrl (ctx: MeasureContext, workspace: WorkspaceId, objectName: string): string {
|
||||||
const path = `/blob/${workspace.name}/${objectName}`
|
const path = `/blob/${workspace.name}/${encodeURIComponent(objectName)}`
|
||||||
return concatLink(this.endpoint, path)
|
return concatLink(this.endpoint, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ export class Client {
|
|||||||
|
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
const options: FormData.AppendOptions = {
|
const options: FormData.AppendOptions = {
|
||||||
filename: objectName,
|
filename: encodeURIComponent(objectName),
|
||||||
contentType: metadata.type,
|
contentType: metadata.type,
|
||||||
knownLength: metadata.size,
|
knownLength: metadata.size,
|
||||||
header: {
|
header: {
|
||||||
|
Loading…
Reference in New Issue
Block a user