Skip to content

Commit d891e14

Browse files
Web3NLclaude
andcommitted
chore: apply cargo fmt formatting to asset_router and update Cargo.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3a091c5 commit d891e14

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages-rs/my-canister-frontend/src/asset_router.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use flate2::write::GzEncoder;
21
use flate2::Compression;
2+
use flate2::write::GzEncoder;
33
use ic_asset_certification::{Asset, AssetConfig, AssetEncoding, AssetFallbackConfig, AssetRouter};
44
use ic_http_certification::StatusCode;
55
use include_dir::Dir;
@@ -12,8 +12,8 @@ use std::io::Write;
1212
/// Files with extensions not in this list will be rejected unless
1313
/// explicitly allowed via [`FrontendConfig::extra_allowed_extensions`].
1414
pub const DEFAULT_ALLOWED_EXTENSIONS: &[&str] = &[
15-
"html", "js", "mjs", "css", "png", "jpg", "jpeg", "gif", "webp", "svg", "ico", "avif",
16-
"woff", "woff2", "ttf", "otf", "eot", "json", "xml", "txt", "wasm", "map",
15+
"html", "js", "mjs", "css", "png", "jpg", "jpeg", "gif", "webp", "svg", "ico", "avif", "woff",
16+
"woff2", "ttf", "otf", "eot", "json", "xml", "txt", "wasm", "map",
1717
];
1818

1919
/// Maximum file size in bytes (2 MB).
@@ -158,7 +158,14 @@ fn process_dir_recursive(
158158
} else {
159159
format!("{base_path}/{subdir_name}")
160160
};
161-
process_dir_recursive(subdir, &new_base_path, assets, asset_configs, seen_paths, config)?;
161+
process_dir_recursive(
162+
subdir,
163+
&new_base_path,
164+
assets,
165+
asset_configs,
166+
seen_paths,
167+
config,
168+
)?;
162169
}
163170
Ok(())
164171
}
@@ -276,17 +283,13 @@ fn create_default_headers(_content_type: &str) -> Vec<(String, String)> {
276283
),
277284
(
278285
"Permissions-Policy".into(),
279-
"accelerometer=(), camera=(), geolocation=(), microphone=(), payment=(), usb=()"
280-
.into(),
286+
"accelerometer=(), camera=(), geolocation=(), microphone=(), payment=(), usb=()".into(),
281287
),
282288
(
283289
"Cross-Origin-Opener-Policy".into(),
284290
"same-origin-allow-popups".into(),
285291
),
286-
(
287-
"Cross-Origin-Resource-Policy".into(),
288-
"same-origin".into(),
289-
),
292+
("Cross-Origin-Resource-Policy".into(), "same-origin".into()),
290293
]
291294
}
292295

@@ -562,12 +565,10 @@ mod tests {
562565
#[test]
563566
fn includes_cross_origin_opener_policy() {
564567
let headers = create_default_headers("text/html");
565-
assert!(
566-
headers.contains(&(
567-
"Cross-Origin-Opener-Policy".into(),
568-
"same-origin-allow-popups".into(),
569-
))
570-
);
568+
assert!(headers.contains(&(
569+
"Cross-Origin-Opener-Policy".into(),
570+
"same-origin-allow-popups".into(),
571+
)));
571572
}
572573

573574
#[test]

0 commit comments

Comments
 (0)