Skip to content

Commit

Permalink
fix(store-github): join file and instance paths to normalise client url
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Sep 27, 2024
1 parent 3a83733 commit a9ff68e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/store-github/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from "node:path";
import process from "node:process";
import { Buffer } from "node:buffer";
import makeDebug from "debug";
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit a9ff68e

Please sign in to comment.