Upcoming breaking change to asset canister’s URL decoding

TLDR: we’d like to change the asset canister’s URL decoding logic like this. Any objections?

Long version:
Hello everyone,

Since the beginning, the asset canister has used a custom implementation of URL decoding, which leads to issues with many not-so-uncommon characters (e.g. é or è, which are very common in French) since it does not match what new Request("https://example.com/% $").url produces. The new implementation will use the percent-encoding crate, which follows the whatwg standard. You can look at the PR here.

While this is a breaking, potentially inconvenient change, we believe that moving forward this will be much more convenient both for maintaining the code of the asset canister and the boundary nodes, and for frontend devs as this will match much more what they expect.

Timeline: If no major concerns are raised, I would merge the PR late next week or early the week after. The change would show up in the next dfx beta (probably 0.21.0-beta.0) release, which will most likely be made around June 18, and it would be promoted to the default dfx version three weeks later, around July 9.

2 Likes

Does this just affect the asset canister? Or does it affect other canisters that may parse URLs to do things?

Many canisters use xhttps://mops.one/http-parser on motoko canisters. I’m not sure what to look for to know if this will break things.

This might be an interesting improvement for Oisy. We might want to test something there.

However, if I understand correctly, you are planning to use encoded strings, right? (In JS, encodeURIComponent). I was under the impression that this wasn’t supported by the certification or the boundary nodes. Did that change?

I used to use such encoding, but at the same time that I implemented certification v2, and after discussing it with @NathanosDev, I removed such encoding to only support “native” string URLs as it was not supported by those services.

This will only affect the asset canister. That’s the canister you get when you say "type": "assets" in dfx.json

The paths in the certification tree aren’t changing. The asset canister is just changing how it decodes the request path when checking for a matching file.

1 Like