chore: pass through headers from LFS batch response
This commit is contained in:
parent
9250c7d862
commit
327b0ebbb8
1 changed files with 7 additions and 2 deletions
|
@ -18,6 +18,7 @@ interface LFSInfoResponse {
|
||||||
actions: {
|
actions: {
|
||||||
download: {
|
download: {
|
||||||
href: string;
|
href: string;
|
||||||
|
header?: Record<string, string>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}[];
|
}[];
|
||||||
|
@ -61,12 +62,16 @@ export default async function downloadBlobFromPointer(
|
||||||
|
|
||||||
// Request the actual blob
|
// Request the actual blob
|
||||||
|
|
||||||
const lfsObjectDownloadURL = lfsInfoResponseData.objects[0].actions.download.href;
|
const downloadAction = lfsInfoResponseData.objects[0].actions.download;
|
||||||
|
const lfsObjectDownloadURL = downloadAction.href;
|
||||||
|
const lfsObjectDownloadHeaders = downloadAction.header ?? {};
|
||||||
|
|
||||||
|
const dlHeaders = { ...headers, ...lfsObjectDownloadHeaders };
|
||||||
|
|
||||||
const { body: lfsObjectBody } = await request({
|
const { body: lfsObjectBody } = await request({
|
||||||
url: lfsObjectDownloadURL,
|
url: lfsObjectDownloadURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers,
|
headers: dlHeaders,
|
||||||
});
|
});
|
||||||
|
|
||||||
return await bodyToBuffer(lfsObjectBody);
|
return await bodyToBuffer(lfsObjectBody);
|
||||||
|
|
Loading…
Reference in a new issue