[pbs-devel] applied: [PATCH] api types: make region regex less strict
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Jul 25 16:40:02 CEST 2025
Region syntax is not really specified, while AWS has only a small set
of predefined possible regions all following a relatively fixed
pattern, other providers do not necessarily have to use the same
pattern.
E.g., the Hetzner S3 object storage has regions like 'nbg1' or 'fsn1'
or 'hel1', which got all rejected by the rather strict pattern here.
As client we can only loose with overly strict patterns, so while
obviously broken/impossible values should be caught early for better
UX, restricting to much is not ideal.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
proxmox-s3-client/src/api_types.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxmox-s3-client/src/api_types.rs b/proxmox-s3-client/src/api_types.rs
index 2234f121..eff15f37 100644
--- a/proxmox-s3-client/src/api_types.rs
+++ b/proxmox-s3-client/src/api_types.rs
@@ -22,8 +22,8 @@ const_regex! {
pub S3_BUCKET_NAME_REGEX = r"^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$";
/// Regex to match S3 endpoints including template patterns.
pub S3_ENDPOINT_REGEX = concatcp!(r"^(?:", S3_ENDPOINT_NAME_STR, "|", IPRE_STR, r")$");
- /// Regex to match S3 regions.
- pub S3_REGION_REGEX = r"(^auto$)|(^[a-z]{2,}(?:-[a-z\d]+)+$)";
+ /// Regex to match S3 regions, similar to SAFE_ID_REGEX but only lower case and without dot.
+ pub S3_REGION_REGEX = r"^[_a-z\d][-_a-z\d]+$";
}
/// S3 REST API endpoint format.
--
2.47.2
More information about the pbs-devel
mailing list