Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Fix relative file navigation
Merged did:key:z6MkkfM3...sVz5 opened 1 year ago

Navigating to a project.source view without defining a path, would skip the canonicalization of the path and end up returning /nodes/seed.radicle.garden/CONTRIBUTING.md which isn’t a valid link and would throw errors.

By instead of requiring this.#route to have a path, checking if this.#route.resource === "project.source we can fallback to README.md and don’t run into errors.

check check-visual check-unit-test check-http-client-unit-test check-radicle-httpd check-e2e check-build check-http

👉 Preview 👉 Workflow runs 👉 Branch on GitHub

1 file changed +1 -1 da14ca65 cbb6c557
modified src/lib/markdown.ts
@@ -71,7 +71,7 @@ export class Renderer extends BaseRenderer {
      return `<a ${title ? `title="${title}"` : ""} href="${href.toLowerCase()}">${text}</a>`;
    }

-
    if ("path" in this.#route && !isUrl(href)) {
+
    if (this.#route.resource === "project.source" && !isUrl(href)) {
      href = routeToPath({
        ...this.#route,
        path: canonicalize(href, this.#route.path || "README.md"),