mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Package.Fetch: tighten up check for path outside root
This commit is contained in:
parent
6d84caf727
commit
5e7c44a321
2 changed files with 4 additions and 3 deletions
|
|
@ -257,7 +257,9 @@ pub fn run(f: *Fetch) RunError!void {
|
|||
f.hash_tok,
|
||||
try eb.addString("path-based dependencies are not hashed"),
|
||||
);
|
||||
if (std.mem.startsWith(u8, pkg_root.sub_path, "../")) {
|
||||
if (std.mem.startsWith(u8, pkg_root.sub_path, "../") or
|
||||
std.mem.eql(u8, pkg_root.sub_path, ".."))
|
||||
{
|
||||
return f.fail(
|
||||
f.location_tok,
|
||||
try eb.printString("dependency path outside project: '{}{s}'", .{
|
||||
|
|
|
|||
|
|
@ -318,8 +318,7 @@ const Parse = struct {
|
|||
|
||||
for (array_init.ast.elements) |elem_node| {
|
||||
const path_string = try parseString(p, elem_node);
|
||||
const normalized = try std.fs.path.resolve(p.arena, &.{path_string});
|
||||
try p.paths.put(p.gpa, normalized, {});
|
||||
try p.paths.put(p.gpa, path_string, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue