Skip to content

Commit

Permalink
chore(cli): validate links with trailing slashes (#5652)
Browse files Browse the repository at this point in the history
* remove trailing

* add entries

* new version
  • Loading branch information
chdeskur authored Jan 19, 2025
1 parent f2fc039 commit d822cbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions fern/pages/changelogs/cli/2025-01-19.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.50.10
**`(fix):`** An addition to the broken link checker to further reduce false positives.

## 0.50.9
**`(fix):`** The Fern CLI no longer logs the full API request when finishing docs registration,
reducing unnecessary log output.
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
- changelogEntry:
- summary: |
An addition to the broken link checker to further reduce false positives.
type: fix
irVersion: 55
version: 0.50.10

- changelogEntry:
- summary: |
The Fern CLI no longer logs the full API request when finishing docs registration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { wrapWithHttps } from "@fern-api/docs-resolver";
import { AbsoluteFilePath, RelativeFilePath, dirname, doesPathExist, join } from "@fern-api/fs-utils";

import { getRedirectForPath } from "./redirect-for-path";
import { addLeadingSlash, removeLeadingSlash } from "./url-utils";
import { addLeadingSlash, removeLeadingSlash, removeTrailingSlash } from "./url-utils";

/**
* Checks if the given path exists in the docs.
Expand Down Expand Up @@ -40,6 +40,7 @@ export async function checkIfPathnameExists({
basePath?: string;
};
}): Promise<true | string[]> {
pathname = removeTrailingSlash(pathname);
const slugs = absoluteFilepath != null ? (absoluteFilePathsToSlugs.get(absoluteFilepath) ?? []) : [];

// base case: empty pathname is valid
Expand Down

0 comments on commit d822cbc

Please sign in to comment.