From cef8d75983d301ec0d1e78e9ce2c1c460ffe91e0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 7 Mar 2025 16:25:55 +0100 Subject: [PATCH] admin api: avoid overwriting redirect rules in UpdateBucket --- src/api/admin/bucket.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index ca5b2d86..966546bb 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -371,13 +371,17 @@ impl RequestHandler for UpdateBucketRequest { if let Some(wa) = self.body.website_access { if wa.enabled { + let (redirect_all, routing_rules) = match state.website_config.get() { + Some(wc) => (wc.redirect_all.clone(), wc.routing_rules.clone()), + None => (None, Vec::new()), + }; state.website_config.update(Some(WebsiteConfig { index_document: wa.index_document.ok_or_bad_request( "Please specify indexDocument when enabling website access.", )?, error_document: wa.error_document, - redirect_all: None, - routing_rules: Vec::new(), + redirect_all, + routing_rules, })); } else { if wa.index_document.is_some() || wa.error_document.is_some() {