Skip to content

Preserve trailing slash in file path where it makes sense#268

Merged
mhdawson merged 1 commit intonodejs:mainfrom
yagehu:trailing-slash
Jun 10, 2024
Merged

Preserve trailing slash in file path where it makes sense#268
mhdawson merged 1 commit intonodejs:mainfrom
yagehu:trailing-slash

Conversation

@yagehu
Copy link
Contributor

@yagehu yagehu commented Jun 8, 2024

This commit fixes the behavior of path_open such that if the path contains trailing slashes and the target file is not a directory, the call errors. This behavior is consistent with Linux host, Wasmtime, WAMR, and WasmEdge.

fixes #267

@yagehu yagehu changed the title Preserve trailing slash in file path Preserve trailing slash in file path where it makes sense Jun 8, 2024
@yagehu yagehu force-pushed the trailing-slash branch 5 times, most recently from 408d98b to 24348b8 Compare June 8, 2024 17:54
@yagehu yagehu changed the title Preserve trailing slash in file path where it makes sense [Draft] Preserve trailing slash in file path where it makes sense Jun 8, 2024
@yagehu yagehu force-pushed the trailing-slash branch 2 times, most recently from 6bac726 to 9d5c862 Compare June 8, 2024 18:11
This commit fixes the behavior of `path_open` such that if the path
contains trailing slashes and the target file is not a directory, the
call errors. This behavior is consistent with Linux host, Wasmtime,
WAMR, and WasmEdge.

fixes nodejs#267

Signed-off-by: Yage Hu <me@huyage.dev>
@yagehu yagehu changed the title [Draft] Preserve trailing slash in file path where it makes sense Preserve trailing slash in file path where it makes sense Jun 8, 2024
@guybedford
Copy link
Contributor

It would be good to align with implementations on these errors, and given the current architecture handling it in the path normalization seems a good way to go about it.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mhdawson mhdawson merged commit afffaaa into nodejs:main Jun 10, 2024
@yagehu yagehu deleted the trailing-slash branch October 19, 2024 14:57
@aduh95 aduh95 mentioned this pull request Aug 16, 2025
aduh95 added a commit that referenced this pull request Sep 2, 2025
Notable changes:

- Disallow malformed path with null byte (#266) (7aaa0b4)
- Preserve trailing slash in file path (#268) (afffaaa)
- Disallow absolute path at the raw WASI level (#270) (9811374)
- Error if creating symlink to absolute path (#272) (c8d4f01)
- Add cflite and document normalize path (#280) (6eeddba)
- Resolve old_path in uvwasi_path_symlink() (#303) (98da5ad)
- Use index rather than `telldir`/`seekdir` to represent `fd_readdir` cookie (#298) (392e1f1)
- fix: static library name (#305) (146e516)
- fix: do not put header files in a subfolders (#302) (ec28b58)
- fix: explicitly export symbols (#308) (4e9b4e0)
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.

path_open does not respect trailing slashes

3 participants