From 8e172ebef9c80e680cd6cd4ca5f50e42584adc5e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 13 Feb 2024 00:01:34 -0500 Subject: [PATCH] fix: append auth token to url --- src/methods/download.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/methods/download.ts b/src/methods/download.ts index a10c917..e3b0d69 100644 --- a/src/methods/download.ts +++ b/src/methods/download.ts @@ -5,6 +5,7 @@ import { CustomClientOptions, optionsToConfig } from "../utils/options.js"; import path from "path"; import { DEFAULT_UPLOAD_OPTIONS } from "#methods/upload.js"; import { getS5DownloadCid, getS5MetadataCid } from "#generated/index.js"; +import { addUrlQuery } from "#utils/url.js"; /** * Custom download options. @@ -81,7 +82,10 @@ export async function getCidUrl( cid: string, customOptions: CustomDownloadOptions = {}, ): Promise { - return path.join(this.portalUrl, cid); + const opt = { ...this.customOptions, customOptions }; + return addUrlQuery(path.join(this.portalUrl, cid), { + auth_token: opt.ApiKey, + }); } /**