Skip to content

Commit 38cb169

Browse files
committed
don't interpret subdirectories in repo-url
1 parent 896bef2 commit 38cb169

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/project/types/book/book-config.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ import {
6262
repoUrlIcon,
6363
websiteConfigActions,
6464
websiteProjectConfig,
65-
websiteRepoInfoFromUrl,
6665
} from "../website/website-config.ts";
6766

6867
import { kSidebarLogo } from "../website/website-navigation.ts";
@@ -244,14 +243,7 @@ function siteRepoUrl(site: Metadata) {
244243
join(repoUrl, `tree/${branch}/${subdir}`),
245244
);
246245
} else {
247-
const repoInfo = websiteRepoInfoFromUrl(repoUrl);
248-
if (repoInfo.path) {
249-
return pathWithForwardSlashes(
250-
join(repoInfo.baseUrl, `tree/${branch}`, repoInfo.path),
251-
);
252-
} else {
253-
return repoInfo.baseUrl;
254-
}
246+
return repoUrl;
255247
}
256248
}
257249

src/project/types/website/website-config.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,28 +197,16 @@ export function websiteRepoInfo(
197197
path: ensureTrailingSlash(repoSubdir),
198198
};
199199
} else {
200-
return websiteRepoInfoFromUrl(repoUrl);
200+
return {
201+
baseUrl: repoUrl,
202+
path: "",
203+
};
201204
}
202205
} else {
203206
return undefined;
204207
}
205208
}
206209

207-
export function websiteRepoInfoFromUrl(repoUrl: string) {
208-
const match = repoUrl.match(/(https?:\/\/(?:[^\/]+\/){3})(.*)/);
209-
if (match) {
210-
return {
211-
baseUrl: match[1],
212-
path: ensureTrailingSlash(match[2]) || "",
213-
};
214-
} else {
215-
return {
216-
baseUrl: repoUrl,
217-
path: "",
218-
};
219-
}
220-
}
221-
222210
export function websiteRepoBranch(project?: ProjectConfig): string {
223211
return websiteConfigString(kSiteRepoBranch, project) || "main";
224212
}

0 commit comments

Comments
 (0)