Skip to content

Commit b53a220

Browse files
committed
Fix #2910
1 parent 34ce994 commit b53a220

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ title: Changelog
1616
- `@include` with regions now works on files with CRLF line endings, #2902.
1717
- Generated page names now correctly handles UTF-8 characters requiring more than 16 bits #2905.
1818
- Fixed a crash when converting `module.exports = []`, #2909.
19+
- Fixed URL generation which introduced a superfluous `./` in relative links, #2910.
1920

2021
### Thanks!
2122

src/lib/output/router.ts

+5
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ export abstract class BaseRouter implements Router {
254254
if (full[i] === "/") ++slashes;
255255
}
256256

257+
// #2910 avoid urls like ".././"
258+
if (target == "./" && slashes !== 0) {
259+
return "../".repeat(slashes);
260+
}
261+
257262
return "../".repeat(slashes) + target;
258263
}
259264

src/test/output/router.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ describe("KindRouter", () => {
150150
router.baseRelativeUrl(project, "assets/search.js"),
151151
"assets/search.js",
152152
);
153+
154+
equal(
155+
router.baseRelativeUrl(Foo, "./"),
156+
"../",
157+
);
158+
equal(
159+
router.baseRelativeUrl(project, "./"),
160+
"./",
161+
);
153162
});
154163

155164
it("Can get a full URL to a reflection", () => {

0 commit comments

Comments
 (0)