Skip to content

Commit

Permalink
chore: redo
Browse files Browse the repository at this point in the history
Signed-off-by: David Dal Busco <[email protected]>
  • Loading branch information
peterpeterparker committed Nov 28, 2023
1 parent 55f7b3a commit aebe6d8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/satellite/src/storage/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ pub fn get_routing(

let MapUrl { path, token } = map_url(&url)?;

// We return the asset that matches the effective path
let asset: Option<(Asset, Memory)> = get_public_asset(path.clone(), token.clone());

match asset {
None => (),
Some(_) => {
return Ok(Routing::Default(RoutingDefault { url: path, asset }));
}
}

// ⚠️ Limitation: requesting an url without extension try to resolve first a corresponding asset
// e.g. /.well-known/hello -> try to find /.well-known/hello.html
// Therefore if a file without extension is uploaded to the storage, it is important to not upload an .html file with the same name next to it or a folder/index.html
Expand All @@ -52,6 +42,16 @@ pub fn get_routing(
}
}

// We return the asset that matches the effective path
let asset: Option<(Asset, Memory)> = get_public_asset(path.clone(), token.clone());

match asset {
None => (),
Some(_) => {
return Ok(Routing::Default(RoutingDefault { url: path, asset }));
}
}

if include_alternative_routing {
// Search for potential redirect
let redirect = get_routing_redirect(&path);
Expand Down

0 comments on commit aebe6d8

Please sign in to comment.