diff --git a/ui/src/client/api/snapshot.ts b/ui/src/client/api/snapshot.ts index 6cb8989ae..bef8357a3 100644 --- a/ui/src/client/api/snapshot.ts +++ b/ui/src/client/api/snapshot.ts @@ -72,12 +72,6 @@ export type ImageProps = { height: number } -export type Thumbnail = { - base64: string - width: number - height: number -} - export type ListQueryParams = { file_id: string page?: string diff --git a/webdav/src/client/api.ts b/webdav/src/client/api.ts index 3fa45e06c..2822ae1a7 100644 --- a/webdav/src/client/api.ts +++ b/webdav/src/client/api.ts @@ -28,13 +28,9 @@ export type File = { name: string type: FileType parentId: string - version: number - original?: Download - preview?: Download - thumbnail?: Thumbnail - snapshots: Snapshot[] permission: PermissionType isShared: boolean + snapshot?: Snapshot createTime: string updateTime?: string } @@ -258,7 +254,7 @@ export class FileAPI { return new Promise((resolve, reject) => { const ws = createWriteStream(outputPath) const request = get( - `${API_URL}/v2/files/${file.id}/original${file.original.extension}?access_token=${this.token.access_token}`, + `${API_URL}/v2/files/${file.id}/original${file.snapshot.original.extension}?access_token=${this.token.access_token}`, (response) => { response.pipe(ws) ws.on('finish', () => { diff --git a/webdav/src/handler/handle-head.ts b/webdav/src/handler/handle-head.ts index d79ebca8d..f4a7f199e 100644 --- a/webdav/src/handler/handle-head.ts +++ b/webdav/src/handler/handle-head.ts @@ -23,7 +23,7 @@ async function handleHead( const file = await new FileAPI(token).getByPath(decodeURIComponent(req.url)) if (file.type === FileType.File) { res.statusCode = 200 - res.setHeader('Content-Length', file.original.size) + res.setHeader('Content-Length', file.snapshot.original.size) res.end() } else { res.statusCode = 200 diff --git a/webdav/src/handler/handle-propfind.ts b/webdav/src/handler/handle-propfind.ts index b5e6e8b55..d1e1222f0 100644 --- a/webdav/src/handler/handle-propfind.ts +++ b/webdav/src/handler/handle-propfind.ts @@ -32,8 +32,8 @@ async function handlePropfind( ${ - file.original - ? `${file.original.size}` + file.snapshot.original + ? `${file.snapshot.original.size}` : '' } ${new Date( @@ -81,8 +81,8 @@ async function handlePropfind( item.type === FileType.Folder ? '' : '' } ${ - item.type === FileType.File && item.original - ? `${item.original.size}` + item.type === FileType.File && item.snapshot.original + ? `${item.snapshot.original.size}` : '' } ${new Date( diff --git a/webdav/src/infra/error.ts b/webdav/src/infra/error.ts index 274b9f945..2aedb0980 100644 --- a/webdav/src/infra/error.ts +++ b/webdav/src/infra/error.ts @@ -16,4 +16,5 @@ export function handleError(err: any, res: ServerResponse) { res.statusCode = 500 res.end() } + console.error(err) }