mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 01:21:01 +00:00
Add documentation to host_to_bucket
This commit is contained in:
parent
cacf8ddf2d
commit
3cb3994cd2
1 changed files with 6 additions and 0 deletions
|
@ -93,6 +93,12 @@ fn authority_to_host(authority: &str) -> Result<&str, Error> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Host to bucket
|
||||
///
|
||||
/// Convert a host, like "bucket.garage-site.tld" or "john.doe.com"
|
||||
/// to the corresponding bucket, resp. "bucket" and "john.doe.com"
|
||||
/// considering that ".garage-site.tld" is the "root domain".
|
||||
/// This behavior has been chosen to follow AWS S3 semantic.
|
||||
fn host_to_bucket<'a>(host: &'a str, root: &str) -> &'a str {
|
||||
if root.len() >= host.len() || !host.ends_with(root) {
|
||||
return host;
|
||||
|
|
Loading…
Reference in a new issue