Skip to content

fix(plugin): handle non-ASCII characters in project paths#3786

Open
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/non-ascii-path-plugin-3695
Open

fix(plugin): handle non-ASCII characters in project paths#3786
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/non-ascii-path-plugin-3695

Conversation

@maruthang
Copy link
Copy Markdown

PR Checklist

  • The commit message follows our guidelines
  • Tests for the changes have been added
  • Docs have been added / updated

PR Type

  • Bugfix

What is the current behavior?

When the project is in a folder with non-ASCII characters (e.g., "testnéstcli"), the plugin generates absolute paths in compiled output instead of relative paths, causing "Cannot find module" errors at runtime.

Issue Number: #3695

What is the new behavior?

Added safeDecodeURIComponent() to decode URL-encoded characters before computing relative paths in replaceImportPath(). TypeScript URL-encodes non-ASCII chars in type references, but the filesystem path stays un-encoded — this mismatch caused posix.relative() to fail. 11 regression tests added.

Does this PR introduce a breaking change?

  • No

TypeScript URL-encodes non-ASCII chars in type import paths but
the file system path stays un-encoded. This caused replaceImportPath
to emit absolute paths instead of relative ones when the project
directory contained non-ASCII characters. Decode URI components
before computing relative paths.

Closes nestjs#3695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant