apparently we do need that check?
All checks were successful
AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 7m36s

This commit is contained in:
Emil Lerch 2023-08-30 13:49:56 -07:00
parent fb34e556f7
commit 6755099c36
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -409,11 +409,7 @@ fn canonicalUri(allocator: std.mem.Allocator, path: []const u8, double_encode: b
log.debug("encoding path: {s}", .{path}); log.debug("encoding path: {s}", .{path});
var encoded_once = try encodeUri(allocator, path); var encoded_once = try encodeUri(allocator, path);
log.debug("encoded path (1): {s}", .{encoded_once}); log.debug("encoded path (1): {s}", .{encoded_once});
// The line below had this condition, with the additional comment if (!double_encode or std.mem.indexOf(u8, path, "%") != null) { // TODO: Is the indexOf condition universally true?
// "Is the indexOf condition universally true?"
// Right now I'm not sure why this was added, but it seems to be a mistake
// or std.mem.indexOf(u8, path, "%") != null) { // Is the indexOf condition universally true?
if (!double_encode) {
if (std.mem.lastIndexOf(u8, encoded_once, "?")) |i| { if (std.mem.lastIndexOf(u8, encoded_once, "?")) |i| {
_ = allocator.resize(encoded_once, i); _ = allocator.resize(encoded_once, i);
return encoded_once[0..i]; return encoded_once[0..i];