From 1b2b51be88e48d6652a248c5adfbe9d76f40a860 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Sun, 27 Aug 2023 23:18:15 -0700 Subject: [PATCH] fix path not added on override --- src/aws_http.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aws_http.zig b/src/aws_http.zig index f7f69c1..9dc44ff 100644 --- a/src/aws_http.zig +++ b/src/aws_http.zig @@ -268,7 +268,7 @@ fn endpointForRequest(allocator: std.mem.Allocator, service: []const u8, request const environment_override = endpoint_override orelse try getEnvironmentVariable(allocator, "AWS_ENDPOINT_URL"); if (environment_override) |override| { const uri = try allocator.dupe(u8, override); - return endPointFromUri(allocator, uri); + return endPointFromUri(allocator, uri, request.path); } // Fallback to us-east-1 if global endpoint does not exist. const realregion = if (std.mem.eql(u8, options.region, "aws-global")) "us-east-1" else options.region; @@ -359,7 +359,7 @@ fn s3BucketFromPath(path: []const u8) []const u8 { /// /// allocator: Will be used only to construct the EndPoint struct /// uri: string constructed in such a way that deallocation is needed -fn endPointFromUri(allocator: std.mem.Allocator, uri: []const u8) !EndPoint { +fn endPointFromUri(allocator: std.mem.Allocator, uri: []const u8, path: []const u8) !EndPoint { var scheme: []const u8 = ""; var host: []const u8 = ""; var port: u16 = 443; @@ -401,7 +401,7 @@ fn endPointFromUri(allocator: std.mem.Allocator, uri: []const u8) !EndPoint { .scheme = scheme, .allocator = allocator, .port = port, - .path = try allocator.dupe(u8, "/"), + .path = try allocator.dupe(u8, path), }; }