[IO] versionId extraction simplified.

Reducing cognitive load.
This commit is contained in:
Saad Ur Rahman 2022-03-14 22:27:58 -04:00
parent 679abaafdc
commit 7b35c79b04
No known key found for this signature in database
GPG Key ID: C6773CD21542E49C

View File

@ -782,15 +782,12 @@ namespace S3
// Extract object version ID from query string. // Extract object version ID from query string.
{ {
version_id = "";
const String version_key = "versionId="; const String version_key = "versionId=";
const auto query_string = uri.getQuery(); const auto query_string = uri.getQuery();
auto start = query_string.rfind(version_key); auto start = query_string.rfind(version_key);
if (start == std::string::npos) if (start != std::string::npos)
{
version_id = "";
}
else
{ {
start += version_key.length(); start += version_key.length();
start = start == std::string::npos ? query_string.length() : start + 1; start = start == std::string::npos ? query_string.length() : start + 1;