S3-compatible object store for small self-hosted geo-distributed deployments https://garagehq.deuxfleurs.fr/
  • Rust 94.5%
  • Clojure 1.8%
  • Shell 1.7%
  • Nix 1.2%
  • Python 0.6%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dominik Menke 3ebe456197 fix: improve routing of keys starting with "/" (fix #1178) (#1465)
Path-style URLs of the form /bucket//key address an object whose key begins with "/". Two greedy uses of `trim_start_matches('/')` were collapsing these leading slashes away:

- `uri.path().trim_start_matches('/')` stripped all leading slashes from the raw path before any further parsing.
- `p.trim_start_matches('/')` stripped leading slashes from the remainder after `split_once('/')` had already consumed the bucket/key separator

The combined effect wath that `HEAD /bucket//` and `GET /bucket//` produced an empty key, which the router treated as bucket-level operations (HeadBucket -> 200 OK, and ListObjectsV2) instead of an object-level op (HeadObject/GetObject -> 404 NoSuchKey).

The fix is simple: Replace the first `trim_start_matches` with `strip_prefix` (to strip exactly one separator slash) and remove the second one entirely. Path-style and vhost-style requests are now consistent: a double slash in the URL correctly addresses a key whose name begins with "/".

Regression tests added for `HEAD //` and `GET //` requests in both request styles.

Fixes: #1464

---

Disclaimer: I'm not fluent in Rust and I did use an LLM to explain the code to me. All code was written by me.

I'm not sure whether the large `test_cases!` block in the `test_aws_doc_examples` function is the right place for my tests (it certainly was a convenient one).

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1465
2026-07-13 10:46:26 +00:00
.woodpecker run push CI only on main branch (#1343) 2026-02-15 08:57:52 +00:00
doc style: use _count suffix for metrics 2026-06-04 11:47:36 +02:00
fuzz fix fuzz targets 2026-05-13 11:47:57 +02:00
nix add #fuzz devshell and make fuzzing work on nixos 2026-05-01 21:36:17 +00:00
script style: use _count suffix for metrics 2026-06-04 11:47:36 +02:00
src fix: improve routing of keys starting with "/" (fix #1178) (#1465) 2026-07-13 10:46:26 +00:00
.dockerignore Build Docker image 2020-06-30 17:18:42 +02:00
.envrc Implement rpc_secret_file 2023-01-04 18:35:10 +01:00
.gitignore Implement rpc_secret_file 2023-01-04 18:35:10 +01:00
Cargo.lock Fuzz Bucket CRDT (#1442) 2026-05-06 18:55:47 +00:00
Cargo.toml Post review fixes 2026-05-01 21:36:17 +00:00
CONTRIBUTING.md write CONTRIBUTING.md file, first iteration (#1406) 2026-04-26 10:35:17 +00:00
default.nix nix, ci: build with Crane 2025-02-03 16:39:50 +01:00
Dockerfile Improve usability for garage in container by setting entrypoint (#1363) 2026-06-04 11:47:35 +02:00
flake.lock update rust-overlay and use rust 1.95.0 2026-04-23 21:17:27 +02:00
flake.nix add #fuzz devshell and make fuzzing work on nixos 2026-05-01 21:36:17 +00:00
LICENSE Switch to AGPL 2021-03-16 16:35:46 +01:00
Makefile remove cargo build options in makefile to avoid mistakes 2025-02-14 18:06:07 +01:00
README.md [woodpecker] convert drone pipelines to woodpecker 2024-02-08 18:24:52 +01:00
rustfmt.toml Fix the Sync issue. Details: 2020-04-10 22:01:48 +02:00
SECURITY.md add SECURITY.md (#1423) 2026-04-27 07:33:27 +00:00
shell.nix chore: update cmd parameter name in shell.nix 2026-01-29 22:14:34 +00:00
taplo.toml chore: add taplo.toml and resave Cargo.toml 2026-01-29 20:49:28 +01:00
typos.toml Ignore typos in fuzz/ 2026-05-01 21:36:17 +00:00

Garage status-badge

Garage logo

[ Website and documentation | Binary releases | Git repository | Matrix channel ]

Garage is an S3-compatible distributed object storage service designed for self-hosting at a small-to-medium scale.

Garage is designed for storage clusters composed of nodes running at different physical locations, in order to easily provide a storage service that replicates data at these different locations and stays available even when some servers are unreachable. Garage also focuses on being lightweight, easy to operate, and highly resilient to machine failures.

Garage is built by Deuxfleurs, an experimental small-scale self hosted service provider, which has been using it in production since its first release in 2020.

Learn more on our dedicated documentation pages:

Garage is entirely free software released under the terms of the AGPLv3.