Skip to content

fix(cli): normalize path separators to forward slashes on Windows#11813

Closed
thesandlord wants to merge 2 commits intomainfrom
devin/1769478454-fix-windows-path-handling
Closed

fix(cli): normalize path separators to forward slashes on Windows#11813
thesandlord wants to merge 2 commits intomainfrom
devin/1769478454-fix-windows-path-handling

Conversation

@thesandlord
Copy link
Copy Markdown
Contributor

@thesandlord thesandlord commented Jan 27, 2026

Description

Refs: https://buildwithfern.slack.com/archives/C09MPC09FUL/p1769461601587929

Fixes an issue where fern generate --docs on Windows machines produces image paths with Windows absolute paths (e.g., C:\Users\devon\...) that appear in generated HTML/markdown, causing images to fail to load in both local dev and deploy previews.

Changes Made

  • Modified dirname(), join(), and resolve() functions in @fern-api/fs-utils to normalize their output to use forward slashes
  • This ensures cross-platform consistency since Node.js path functions return backslashes on Windows
  • Enabled generate-docs-test-windows CI job to run on PRs (previously only ran on main branch)
  • Added test image to Windows fixture to verify image path resolution with both markdown and HTML img tag syntax

The fix applies convertToOsPath() (which converts \ to /) to the output of these path manipulation functions, matching the existing behavior of AbsoluteFilePath.of() and RelativeFilePath.of().

Testing

  • Existing unit tests pass (10 tests in fs-utils, 147 tests in docs-markdown-utils)
  • Windows CI job (generate-docs-test-windows) will now run on this PR to validate the fix
  • Manual testing on Windows machine (not available in dev environment)

Human Review Checklist

  • Verify the Windows CI job passes (this will confirm the fix works on Windows)
  • Consider if there are other path functions that might need similar treatment
  • Confirm forward slashes work correctly on Windows (they should - Node.js accepts them)

Link to Devin run: https://app.devin.ai/sessions/e3e7f08157a04186931595d467a1e519
Requested by: @thesandlord (Sandeep Dinesh)

On Windows, path functions like path.resolve, path.dirname, and path.join
return paths with backslashes. This caused issues with fern generate --docs
where image paths were being resolved to Windows absolute paths like
C:\Users\devon\... which then appeared in the generated HTML/markdown.

This fix ensures that all path manipulation functions in @fern-api/fs-utils
normalize their output to use forward slashes for cross-platform consistency.
This fixes the issue where images fail to load in local dev and deploy
previews on Windows machines.

Co-Authored-By: Sandeep Dinesh <sandeep@buildwithfern.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Enable generate-docs-test-windows job to run on PRs (not just main)
- Add test image to Windows fixture to verify image path resolution
- Tests both markdown and HTML img tag syntax

Co-Authored-By: Sandeep Dinesh <sandeep@buildwithfern.com>
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 25 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added Stale This PR hasn't has any commits or comments in 25 days or more. and removed Stale This PR hasn't has any commits or comments in 25 days or more. labels Feb 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 25 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the Stale This PR hasn't has any commits or comments in 25 days or more. label Mar 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR was closed because it has been inactive for 5 days after being marked stale.

@github-actions github-actions Bot closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stale This PR hasn't has any commits or comments in 25 days or more.

Development

Successfully merging this pull request may close these issues.

1 participant