mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 08:33:06 +00:00
Fixed verbatim copy of trailing '%' in unescapeStr
This commit is contained in:
parent
f49a8c5431
commit
d8b5831dc4
@ -90,6 +90,8 @@ pub fn unescapeString(allocator: std.mem.Allocator, input: []const u8) error{Out
|
||||
};
|
||||
inptr += 2;
|
||||
outsize += 1;
|
||||
} else {
|
||||
outsize += 1;
|
||||
}
|
||||
} else {
|
||||
inptr += 1;
|
||||
@ -116,6 +118,9 @@ pub fn unescapeString(allocator: std.mem.Allocator, input: []const u8) error{Out
|
||||
|
||||
inptr += 2;
|
||||
outptr += 1;
|
||||
} else {
|
||||
output[outptr] = input[inptr - 1];
|
||||
outptr += 1;
|
||||
}
|
||||
} else {
|
||||
output[outptr] = input[inptr];
|
||||
@ -758,6 +763,10 @@ test "URI unescaping" {
|
||||
defer std.testing.allocator.free(actual);
|
||||
|
||||
try std.testing.expectEqualSlices(u8, expected, actual);
|
||||
|
||||
const decoded = try unescapeString(std.testing.allocator, "/abc%");
|
||||
defer std.testing.allocator.free(decoded);
|
||||
try std.testing.expectEqualStrings("/abc%", decoded);
|
||||
}
|
||||
|
||||
test "URI query escaping" {
|
||||
|
Loading…
Reference in New Issue
Block a user