std.Uri: change specifier for printing with scheme to semicolon ;

Fetch: print scheme when suggesting adding a ref to git URIs
This commit is contained in:
Krzysztof Wolicki 2024-01-18 08:13:04 +01:00 committed by GitHub
parent 6e5bdb5397
commit 14efbbfd89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -318,7 +318,7 @@ pub fn format(
) @TypeOf(writer).Error!void {
_ = options;
const scheme = comptime std.mem.indexOf(u8, fmt, ":") != null or fmt.len == 0;
const scheme = comptime std.mem.indexOf(u8, fmt, ";") != null or fmt.len == 0;
const authentication = comptime std.mem.indexOf(u8, fmt, "@") != null or fmt.len == 0;
const authority = comptime std.mem.indexOf(u8, fmt, "+") != null or fmt.len == 0;
const path = comptime std.mem.indexOf(u8, fmt, "/") != null or fmt.len == 0;
@ -850,7 +850,7 @@ test "format" {
};
var buf = std.ArrayList(u8).init(std.testing.allocator);
defer buf.deinit();
try uri.format(":/?#", .{}, buf.writer());
try buf.writer().print("{;/?#}", .{uri});
try std.testing.expectEqualSlices(u8, "file:/foo/bar/baz", buf.items);
}

View File

@ -915,7 +915,7 @@ fn initResource(f: *Fetch, uri: std.Uri) RunError!Resource {
});
const notes_start = try eb.reserveNotes(notes_len);
eb.extra.items[notes_start] = @intFromEnum(try eb.addErrorMessage(.{
.msg = try eb.printString("try .url = \"{+/}#{}\",", .{
.msg = try eb.printString("try .url = \"{;+/}#{}\",", .{
uri, std.fmt.fmtSliceHexLower(&want_oid),
}),
}));