diff options
author | 2022-02-01 14:42:42 -0800 | |
---|---|---|
committer | 2022-02-01 14:42:42 -0800 | |
commit | 30f5e0d37ce0f806e6cc2509db8dce0d9a85791e (patch) | |
tree | 61ce44403822ee410e3d7586750c69eeeacb2413 | |
parent | 205a6d45b5bf9087c1da898a211930550ed628de (diff) | |
download | bun-30f5e0d37ce0f806e6cc2509db8dce0d9a85791e.tar.gz bun-30f5e0d37ce0f806e6cc2509db8dce0d9a85791e.tar.zst bun-30f5e0d37ce0f806e6cc2509db8dce0d9a85791e.zip |
[path] Fix bug that occasionally caused relative paths to be missing the leading character
-rw-r--r-- | src/resolver/resolve_path.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolver/resolve_path.zig b/src/resolver/resolve_path.zig index f7335a8b4..ca18f1f82 100644 --- a/src/resolver/resolve_path.zig +++ b/src/resolver/resolve_path.zig @@ -253,8 +253,8 @@ pub fn relativeToCommonPath( } if (normalized_to.len > last_common_separator + 1) { - const tail = normalized_to[last_common_separator + 1 ..]; - const insert_leading_slash = tail[0] != separator; + const tail = normalized_to[last_common_separator..]; + const insert_leading_slash = last_common_separator > 0 and normalized_to[last_common_separator - 1] != separator; if (insert_leading_slash) { buf[out_slice.len] = separator; |