mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Package.Fetch: tighten up check for path outside root
This commit is contained in:
parent
6d84caf727
commit
5e7c44a321
@ -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…
x
Reference in New Issue
Block a user