From 7b35c79b04670670483a88796041f74c4357a835 Mon Sep 17 00:00:00 2001 From: Saad Ur Rahman Date: Mon, 14 Mar 2022 22:27:58 -0400 Subject: [PATCH] [IO] versionId extraction simplified. Reducing cognitive load. --- src/IO/S3Common.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/IO/S3Common.cpp b/src/IO/S3Common.cpp index aaf48c38bd6..8d90e516b75 100644 --- a/src/IO/S3Common.cpp +++ b/src/IO/S3Common.cpp @@ -782,15 +782,12 @@ namespace S3 // Extract object version ID from query string. { + version_id = ""; const String version_key = "versionId="; const auto query_string = uri.getQuery(); auto start = query_string.rfind(version_key); - if (start == std::string::npos) - { - version_id = ""; - } - else + if (start != std::string::npos) { start += version_key.length(); start = start == std::string::npos ? query_string.length() : start + 1;