From a9ff68ecb8beb1a0f1f213f8ca85ba404b6d365c Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Fri, 27 Sep 2024 22:22:26 +0200 Subject: [PATCH] fix(store-github): join file and instance paths to normalise client url --- packages/store-github/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/store-github/index.js b/packages/store-github/index.js index b420e4683..174c26273 100644 --- a/packages/store-github/index.js +++ b/packages/store-github/index.js @@ -1,3 +1,4 @@ +import path from "node:path"; import process from "node:process"; import { Buffer } from "node:buffer"; import makeDebug from "debug"; @@ -82,7 +83,8 @@ export default class GithubStore { */ async #client(filePath, method = "GET", body) { const { baseUrl, user, repo, token } = this.options; - const url = new URL(filePath, `${baseUrl}/repos/${user}/${repo}/contents/`); + const apiPath = path.join(`repos/${user}/${repo}/contents`, filePath); + const url = new URL(apiPath, baseUrl); try { const response = await fetch(url.href, {