Skip to content

Commit

Permalink
fix(store-gitea): 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 f2d0067 commit 3a83733
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/store-gitea/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 { IndiekitError } from "@indiekit/error";
Expand Down Expand Up @@ -72,10 +73,11 @@ export default class GiteaStore {
*/
async #client(filePath, method = "GET", body) {
const { instance, user, repo, token } = this.options;
const url = new URL(
const apiPath = path.join(
`api/v1/repos/${user}/${repo}/contents`,
filePath,
`${instance}/api/v1/repos/${user}/${repo}/contents/`,
);
const url = new URL(apiPath, instance);

try {
const response = await fetch(url.href, {
Expand Down

0 comments on commit 3a83733

Please sign in to comment.