From 81712e7a99a0330cf08b78e338f0f21a086a9567 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 31 Dec 2024 12:55:52 -0600 Subject: [PATCH] [bug] S3 provider should limit max key size to 1024 #31 --- repertory/librepertory/include/types/repertory.hpp | 1 + repertory/librepertory/src/providers/s3/s3_provider.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/repertory/librepertory/include/types/repertory.hpp b/repertory/librepertory/include/types/repertory.hpp index 4527d2c0..8ed2d10b 100644 --- a/repertory/librepertory/include/types/repertory.hpp +++ b/repertory/librepertory/include/types/repertory.hpp @@ -41,6 +41,7 @@ constexpr const auto default_task_wait_ms{100U}; constexpr const auto default_timeout_ms{60000U}; constexpr const auto max_orphaned_file_retention_days{std::uint16_t(31U)}; constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)}; +constexpr const auto max_s3_object_name_length{1024U}; constexpr const auto min_cache_size_bytes{ std::uint64_t(100UL * 1024UL * 1024UL)}; constexpr const auto min_download_timeout_secs{std::uint8_t(5U)}; diff --git a/repertory/librepertory/src/providers/s3/s3_provider.cpp b/repertory/librepertory/src/providers/s3/s3_provider.cpp index 9ffe51af..7df29af1 100644 --- a/repertory/librepertory/src/providers/s3/s3_provider.cpp +++ b/repertory/librepertory/src/providers/s3/s3_provider.cpp @@ -44,7 +44,7 @@ namespace { const std::string &object_name) -> repertory::api_error { request.path = object_name; - if (request.path.substr(1U).size() > 1024U) { + if (request.path.substr(1U).size() > max_s3_object_name_length) { return repertory::api_error::name_too_long; }