From 2d03590ab7b28efb5d50cf3bca2079059de17d51 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Thu, 5 Dec 2024 15:35:40 +0100 Subject: [PATCH] more fixes --- packages/hub/src/lib/file-download-info.ts | 2 +- packages/hub/src/lib/list-models.ts | 2 +- packages/hub/src/lib/list-spaces.ts | 2 +- packages/hub/src/lib/paths-info.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/hub/src/lib/file-download-info.ts b/packages/hub/src/lib/file-download-info.ts index 210bd11e7..3dcc79ee9 100644 --- a/packages/hub/src/lib/file-download-info.ts +++ b/packages/hub/src/lib/file-download-info.ts @@ -50,7 +50,7 @@ export async function fileDownloadInfo( const resp = await (params.fetch ?? fetch)(url, { method: "GET", headers: { - ...(params.credentials && { + ...(accessToken && { Authorization: `Bearer ${accessToken}`, }), Range: "bytes=0-0", diff --git a/packages/hub/src/lib/list-models.ts b/packages/hub/src/lib/list-models.ts index 0e62c8caf..db241c458 100644 --- a/packages/hub/src/lib/list-models.ts +++ b/packages/hub/src/lib/list-models.ts @@ -94,7 +94,7 @@ export async function* listModels< const res: Response = await (params?.fetch ?? fetch)(url, { headers: { accept: "application/json", - ...(params?.credentials ? { Authorization: `Bearer ${accessToken}` } : undefined), + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), }, }); diff --git a/packages/hub/src/lib/list-spaces.ts b/packages/hub/src/lib/list-spaces.ts index 36a251afd..a14e7e301 100644 --- a/packages/hub/src/lib/list-spaces.ts +++ b/packages/hub/src/lib/list-spaces.ts @@ -82,7 +82,7 @@ export async function* listSpaces< const res: Response = await (params?.fetch ?? fetch)(url, { headers: { accept: "application/json", - ...(params?.credentials ? { Authorization: `Bearer ${accessToken}` } : undefined), + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : undefined), }, }); diff --git a/packages/hub/src/lib/paths-info.ts b/packages/hub/src/lib/paths-info.ts index c706768f1..ec455f882 100644 --- a/packages/hub/src/lib/paths-info.ts +++ b/packages/hub/src/lib/paths-info.ts @@ -86,7 +86,7 @@ export async function pathsInfo( const resp = await (params.fetch ?? fetch)(url, { method: "POST", headers: { - ...(params.credentials && { + ...(accessToken && { Authorization: `Bearer ${accessToken}`, }), Accept: "application/json",