You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{template.asset_linkkind="trusted_resource_uri"visibility="private"}
{@paramuri: trusted_resource_uri} /** URI postfix to apply. */
{@inject? cdn_prefix: trusted_resource_uri} /** CDN prefix to use, if applicable. */
{ifisNonnull($cdn_prefix)}
{$cdn_prefix}{$uri}
{else}
{$uri}
{/if}
{/template}
From the type names, it's implied that this would work and skip escaping, because, even though the trusted_resource_uri we're returning isn't a constant itself, per se, the two items it is composed of are trusted constants.
Instead, however, invoking this template returns something like: https://cdn_prefix.com/some%2Fescaped%2Furl%2Fhere.css
Which obviously doesn't work. In the above example, the CDN prefix is essentially just a display detail, hence why we want to keep it in Soy. Because there isn't a way to compose string types into trusted_resource_uri types (for good reason) from within Soy itself, is there any way to accomplish the above smoothly?
In our case, uri is itself already a trusted_resource_uri when Soy begins the render process. So, composing these two URIs is a rather challenging task, even from pure Java, because we'd have to disassemble/re-assemble the TrustedResourceUriProto, which is also verboten.
The text was updated successfully, but these errors were encountered:
Sorry I dropped this (busy things ahead). This seems like a corner case with a workaround (a soy function), we likely won't get around to something like this until we finish the Soy formatter
Consider the following template:
From the type names, it's implied that this would work and skip escaping, because, even though the
trusted_resource_uri
we're returning isn't a constant itself, per se, the two items it is composed of are trusted constants.Instead, however, invoking this template returns something like:
https://cdn_prefix.com/some%2Fescaped%2Furl%2Fhere.css
Which obviously doesn't work. In the above example, the CDN prefix is essentially just a display detail, hence why we want to keep it in Soy. Because there isn't a way to compose
string
types intotrusted_resource_uri
types (for good reason) from within Soy itself, is there any way to accomplish the above smoothly?In our case,
uri
is itself already atrusted_resource_uri
when Soy begins the render process. So, composing these two URIs is a rather challenging task, even from pure Java, because we'd have to disassemble/re-assemble theTrustedResourceUriProto
, which is also verboten.The text was updated successfully, but these errors were encountered: