From b9f5ef5b6ef92b8d9f7a924f06dff50856cadd84 Mon Sep 17 00:00:00 2001 From: Pawel Luc Date: Thu, 7 Jun 2018 12:42:55 +0000 Subject: [PATCH] Fixed noname top directory in S3 bucket if a path begins with / --- src/request.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/request.c b/src/request.c index 63174d0..643188c 100644 --- a/src/request.c +++ b/src/request.c @@ -796,7 +796,9 @@ static void canonicalize_resource(const S3BucketContext *context, } } - append("/"); + if(*urlEncodedKey != '/') { + append("/"); + } if (urlEncodedKey && urlEncodedKey[0]) { append(urlEncodedKey); @@ -1111,7 +1113,9 @@ static S3Status compose_uri(char *buffer, int bufferSize, uri_append("%s", hostName); } - uri_append("%s", "/"); + if(*urlEncodedKey != '/') { + uri_append("%s", "/"); + } uri_append("%s", urlEncodedKey);