Skip to content

Commit 13569ac

Browse files
committed
fix repo param in url
1 parent 0de8bea commit 13569ac

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/hub/src/lib/create-branch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { HUB_URL } from "../consts";
22
import { createApiError } from "../error";
33
import type { AccessToken, RepoDesignation } from "../types/public";
4+
import { toRepoId } from "../utils/toRepoId";
45

56
export async function createBranch(params: {
67
repo: RepoDesignation;
@@ -29,7 +30,7 @@ export async function createBranch(params: {
2930
overwrite?: boolean;
3031
}): Promise<void> {
3132
const res = await (params.fetch ?? fetch)(
32-
`${params.hubUrl ?? HUB_URL}/api/repos/${params.repo}/branch/${encodeURIComponent(params.branch)}`,
33+
`${params.hubUrl ?? HUB_URL}/api/repos/${toRepoId(params.repo)}/branch/${encodeURIComponent(params.branch)}`,
3334
{
3435
method: "POST",
3536
headers: {

packages/hub/src/lib/delete-branch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { HUB_URL } from "../consts";
22
import { createApiError } from "../error";
33
import type { AccessToken, RepoDesignation } from "../types/public";
4+
import { toRepoId } from "../utils/toRepoId";
45

56
export async function deleteBranch(params: {
67
repo: RepoDesignation;
@@ -13,7 +14,7 @@ export async function deleteBranch(params: {
1314
fetch?: typeof fetch;
1415
}): Promise<void> {
1516
const res = await (params.fetch ?? fetch)(
16-
`${params.hubUrl ?? HUB_URL}/api/repos/${params.repo}/branch/${encodeURIComponent(params.branch)}`,
17+
`${params.hubUrl ?? HUB_URL}/api/repos/${toRepoId(params.repo)}/branch/${encodeURIComponent(params.branch)}`,
1718
{
1819
method: "DELETE",
1920
headers: {

0 commit comments

Comments
 (0)