Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\0 included in filename option is treated as a character terminator #874

Closed
sapphi-red opened this issue Dec 18, 2024 · 2 comments
Closed

Comments

@sapphi-red
Copy link
Contributor

sapphi-red commented Dec 18, 2024

Reproduction: https://github.com/sapphi-red-repros/lightningcss-filename-containing-nul-character (run npm i && npm start)

In this reproduction resolver.read is called with foo instead of foo\0bar.css which is the filename and what I expect.

Additional context

In Vite (and Rollup), module id can contain any characters and some times starts with \0 (which is a convention for virtual modules: modules that does not exist on file system). While Vite can escape \0 to something else and unescape it back when needed, it would be nice if Vite can just pass in ids containing \0 to the filename option.

@devongovett
Copy link
Member

This might be a bug in napi-rs. Looks like the string is already truncated by the time it gets to lightningcss...

@devongovett
Copy link
Member

Looks like it is fixed in the upgraded version of napi.

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

No branches or pull requests

2 participants