-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(frontend-canister): Add simple aliasing rules #2720
Conversation
src/canisters/frontend/ic-certified-assets/src/state_machine.rs
Outdated
Show resolved
Hide resolved
src/canisters/frontend/ic-certified-assets/src/state_machine.rs
Outdated
Show resolved
Hide resolved
src/canisters/frontend/ic-certified-assets/src/state_machine.rs
Outdated
Show resolved
Hide resolved
|
||
// path like /path/to/my/asset should also be valid for /path/to/my/asset.html | ||
fn redirect(key: &Key) -> Option<Key> { | ||
if !key.ends_with(".html") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended that this should convert /path/to/my/asset.gz
to /path/to/my/asset.gz.html
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily 'intended' but I think if someone creates a file /path/asset.gz.html
and doesn't have a file /path/asset.gz
I don't think it's unreasonable to redirect that
src/canisters/frontend/ic-certified-assets/src/state_machine.rs
Outdated
Show resolved
Hide resolved
src/canisters/frontend/ic-certified-assets/src/state_machine.rs
Outdated
Show resolved
Hide resolved
<asset>
to <asset>.html
for (asset_name, asset) in state.assets.iter_mut() { | ||
for enc in asset.encodings.values_mut() { | ||
enc.certified = false; | ||
let assets_keys: Vec<_> = state.assets.keys().map(|key| key.clone()).collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clone is not nice, but I can't find a better way to satisfy the borrow checker. Suggestions are very welcome
Co-authored-by: Eric Swanson <[email protected]>
Co-authored-by: Eric Swanson <[email protected]>
Description
The asset canister now by default redirects any request to
<asset>
to<asset>.html
.This can be disabled by setting the field
"redirect"
tofalse
in the canister settings in dfx.json.Fixes SDK-789
How Has This Been Tested?
added e2e
Checklist: