mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 10:20:32 +00:00
style: fix formatting
This commit is contained in:
@@ -50,18 +50,36 @@ pub fn routes() -> Router<Arc<AppState>> {
|
||||
// Single-segment name routes (e.g., /v2/alpine/...)
|
||||
.route("/v2/{name}/blobs/{digest}", head(check_blob))
|
||||
.route("/v2/{name}/blobs/{digest}", get(download_blob))
|
||||
.route("/v2/{name}/blobs/uploads/", axum::routing::post(start_upload))
|
||||
.route("/v2/{name}/blobs/uploads/{uuid}", patch(patch_blob).put(upload_blob))
|
||||
.route(
|
||||
"/v2/{name}/blobs/uploads/",
|
||||
axum::routing::post(start_upload),
|
||||
)
|
||||
.route(
|
||||
"/v2/{name}/blobs/uploads/{uuid}",
|
||||
patch(patch_blob).put(upload_blob),
|
||||
)
|
||||
.route("/v2/{name}/manifests/{reference}", get(get_manifest))
|
||||
.route("/v2/{name}/manifests/{reference}", put(put_manifest))
|
||||
.route("/v2/{name}/tags/list", get(list_tags))
|
||||
// Two-segment name routes (e.g., /v2/library/alpine/...)
|
||||
.route("/v2/{ns}/{name}/blobs/{digest}", head(check_blob_ns))
|
||||
.route("/v2/{ns}/{name}/blobs/{digest}", get(download_blob_ns))
|
||||
.route("/v2/{ns}/{name}/blobs/uploads/", axum::routing::post(start_upload_ns))
|
||||
.route("/v2/{ns}/{name}/blobs/uploads/{uuid}", patch(patch_blob_ns).put(upload_blob_ns))
|
||||
.route("/v2/{ns}/{name}/manifests/{reference}", get(get_manifest_ns))
|
||||
.route("/v2/{ns}/{name}/manifests/{reference}", put(put_manifest_ns))
|
||||
.route(
|
||||
"/v2/{ns}/{name}/blobs/uploads/",
|
||||
axum::routing::post(start_upload_ns),
|
||||
)
|
||||
.route(
|
||||
"/v2/{ns}/{name}/blobs/uploads/{uuid}",
|
||||
patch(patch_blob_ns).put(upload_blob_ns),
|
||||
)
|
||||
.route(
|
||||
"/v2/{ns}/{name}/manifests/{reference}",
|
||||
get(get_manifest_ns),
|
||||
)
|
||||
.route(
|
||||
"/v2/{ns}/{name}/manifests/{reference}",
|
||||
put(put_manifest_ns),
|
||||
)
|
||||
.route("/v2/{ns}/{name}/tags/list", get(list_tags_ns))
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,9 @@ impl Storage {
|
||||
secret_key: Option<&str>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: Arc::new(S3Storage::new(s3_url, bucket, region, access_key, secret_key)),
|
||||
inner: Arc::new(S3Storage::new(
|
||||
s3_url, bucket, region, access_key, secret_key,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,8 @@ impl S3Storage {
|
||||
.header("x-amz-date", ×tamp)
|
||||
.header("x-amz-content-sha256", &payload_hash);
|
||||
|
||||
if let Some(auth) = self.sign_request(method.as_str(), key, &payload_hash, ×tamp, &date)
|
||||
if let Some(auth) =
|
||||
self.sign_request(method.as_str(), key, &payload_hash, ×tamp, &date)
|
||||
{
|
||||
request = request.header("Authorization", auth);
|
||||
}
|
||||
@@ -186,9 +187,7 @@ impl StorageBackend for S3Storage {
|
||||
}
|
||||
|
||||
async fn get(&self, key: &str) -> Result<Bytes> {
|
||||
let response = self
|
||||
.signed_request(reqwest::Method::GET, key, None)
|
||||
.await?;
|
||||
let response = self.signed_request(reqwest::Method::GET, key, None).await?;
|
||||
|
||||
if response.status().is_success() {
|
||||
response
|
||||
|
||||
Reference in New Issue
Block a user