Skip to content

Commit

Permalink
chore: update tests to show asset canister properly handles special c…
Browse files Browse the repository at this point in the history
…haracters
  • Loading branch information
sesi200 committed Feb 7, 2025
1 parent fee3a32 commit ec885d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions e2e/tests-dfx/assetscanister.bash
Original file line number Diff line number Diff line change
Expand Up @@ -726,24 +726,27 @@ check_permission_failure() {
}

@test "can serve filenames with special characters in filename" {
# This is observed, not expected behavior
# see https://dfinity.atlassian.net/browse/SDK-1247
install_asset assetscanister

dfx_start

echo "filename is an ae symbol" >'src/e2e_project_frontend/assets/æ'

dfx deploy
ID=$(dfx canister id e2e_project_frontend)
PORT=$(get_webserver_port)

dfx canister call --query e2e_project_frontend list '(record {})'

# decode as expected
assert_command dfx canister call --query e2e_project_frontend http_request '(record{url="/%c3%a6";headers=vec{};method="GET";body=vec{}})'
assert_match "filename is an ae symbol" # candid looks like blob "filename is \c3\a6\0a"

ID=$(dfx canister id e2e_project_frontend)
PORT=$(get_webserver_port)
assert_command curl --fail -vv http://localhost:"$PORT"/%c3%a6?canisterId="$ID"
assert_match "filename is an ae symbol"

assert_command curl --fail -vv http://localhost:"$PORT"?canisterId="$ID"
assert_match "filename is an ae symbol"

# fails with because %e6 is not valid utf-8 percent encoding
assert_command_fail curl --fail -vv http://localhost:"$PORT"/%e6?canisterId="$ID"
Expand Down

0 comments on commit ec885d0

Please sign in to comment.