bug: `export::path:absolute` function fails when `TS_RS_EXPORT_DIR` is set to an absolute path and the `path_bug` test is executed
escritorio-gustavo opened this issue · 0 comments
escritorio-gustavo commented
Describe the bug
Certain combinations of absolute paths and ..
/.
path components can trick the aboslute
function into doing nothing
To Reproduce
- Create a file in this repo at
.cargo/config.toml
with the following content:
[env]
TS_RS_EXPORT_DIR = { value = "./whatever", relative = true }
- Run
cargo test
Why is this happening?
The path ./whatever
is automatically transformed into an absolute path by cargo
due to the relative
flag.
The path_bug
test checks if exporting to ../somewhere/
works.
The paths are combined into something like /usr/me/../somewhere
and passed into the absolute
function.
The absolute
function, seeing the path starts at the root directory /
assumes this is already an absolute path and does nothing
The diff_paths
function, not expecting the absolute
function to return a path containing .
or ..
, panics
Version
8.1.0