diff options
author | Alex Auvolat <alex@adnab.me> | 2023-10-05 16:56:13 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-10-05 16:56:13 +0200 |
commit | 0c431b0c035f4de8ea9d1d9bd0b419bfc74ceabf (patch) | |
tree | 23605595e8faf3712f2dad303aa2cb49e61a0f4d /src/api/admin/api_server.rs | |
parent | 1c13135f253007dfd5c56b2ddf3412c9d66458ec (diff) | |
download | garage-0c431b0c035f4de8ea9d1d9bd0b419bfc74ceabf.tar.gz garage-0c431b0c035f4de8ea9d1d9bd0b419bfc74ceabf.zip |
admin api: increased compatibility for v0/ endpointsv0.9.0-rc2
Diffstat (limited to 'src/api/admin/api_server.rs')
-rw-r--r-- | src/api/admin/api_server.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs index 53503220..4779f924 100644 --- a/src/api/admin/api_server.rs +++ b/src/api/admin/api_server.rs @@ -25,7 +25,8 @@ use crate::admin::bucket::*; use crate::admin::cluster::*; use crate::admin::error::*; use crate::admin::key::*; -use crate::admin::router::{Authorization, Endpoint}; +use crate::admin::router_v0; +use crate::admin::router_v1::{Authorization, Endpoint}; use crate::helpers::host_to_bucket; pub struct AdminApiServer { @@ -229,7 +230,12 @@ impl ApiHandler for AdminApiServer { type Error = Error; fn parse_endpoint(&self, req: &Request<Body>) -> Result<Endpoint, Error> { - Endpoint::from_request(req) + if req.uri().path().starts_with("/v0/") { + let endpoint_v0 = router_v0::Endpoint::from_request(req)?; + Endpoint::from_v0(endpoint_v0) + } else { + Endpoint::from_request(req) + } } async fn handle( |