Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Thumbs

Manav Rathi471df817ac80
diff --git a/web/apps/photos/src/services/download/clients/photos.ts b/web/apps/photos/src/services/download/clients/photos.ts
index 14d9d867c4..5990f46c04 100644
--- a/web/apps/photos/src/services/download/clients/photos.ts
+++ b/web/apps/photos/src/services/download/clients/photos.ts
@@ -16,20 +16,21 @@ export class PhotosDownloadClient implements DownloadClient {
}
async downloadThumbnail(file: EnteFile): Promise<Uint8Array> {
- if (!this.token) {
- throw Error(CustomError.TOKEN_MISSING);
- }
- const resp = await retryAsyncFunction(() =>
+ const token = this.token;
+ if (!token) throw Error(CustomError.TOKEN_MISSING);
+
+ // See: [Note: Passing credentials for self-hosted file fetches]
+ const params = new URLSearchParams({ token });
+ const getThumbnail = () =>
HTTPService.get(
- getThumbnailURL(file.id),
- null,
- { "X-Auth-Token": this.token },
+ `${getThumbnailURL(file.id)}?${params.toString()}`,
+ undefined,
+ undefined,
{ responseType: "arraybuffer", timeout: this.timeout },
- ),
- );
- if (typeof resp.data === "undefined") {
- throw Error(CustomError.REQUEST_FAILED);
- }
+ );
+
+ const resp = await retryAsyncFunction(getThumbnail);
+ if (resp.data === undefined) throw Error(CustomError.REQUEST_FAILED);
return new Uint8Array(resp.data);
}