aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-19 15:08:47 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-19 15:08:47 +0200
commit158dc17a06f8036ed932402a38cf0d5ebbc9f801 (patch)
tree0a32f1ed661f6fa628e7cfedec4136803a561f65
parenta5e8ffeb63a193e5b0e020e4c014687e57f85c23 (diff)
downloadgarage-158dc17a06f8036ed932402a38cf0d5ebbc9f801.tar.gz
garage-158dc17a06f8036ed932402a38cf0d5ebbc9f801.zip
listobjects: fix panic if continuation token is an empty string
-rw-r--r--src/api/s3/list.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/api/s3/list.rs b/src/api/s3/list.rs
index 33d62518..ff5f222d 100644
--- a/src/api/s3/list.rs
+++ b/src/api/s3/list.rs
@@ -530,8 +530,8 @@ impl ListObjectsQuery {
// string in the spec, so we can do whatever we want with it.
// In our case, it is defined as either [ or ] (for include
// representing the key to start with.
- (Some(token), _) => match &token[..1] {
- "[" => Ok(RangeBegin::IncludingKey {
+ (Some(token), _) => match &token.get(..1) {
+ Some("[") => Ok(RangeBegin::IncludingKey {
key: String::from_utf8(
BASE64_STANDARD
.decode(token[1..].as_bytes())
@@ -539,7 +539,7 @@ impl ListObjectsQuery {
)?,
fallback_key: None,
}),
- "]" => Ok(RangeBegin::AfterKey {
+ Some("]") => Ok(RangeBegin::AfterKey {
key: String::from_utf8(
BASE64_STANDARD
.decode(token[1..].as_bytes())