James
12/07/2020, 1:53 AMmapRequestToAsset
doesn't fire for assets that exist in the ASSET_MANIFEST
- they're always served directly from KV. In an older version of kv-asset-handler
, this used to work as per https://github.com/cloudflare/kv-asset-handler/blob/ce0229fe54e38728b2d7796646e20a05ea23b6d1/src/index.ts#L98, which always used mapRequestToAsset
James
12/07/2020, 1:54 AMjpg
, webp
and avif
in the manifest, and someone requests the jpg
, there's no simple way to programatically serve the avif
(such as in a CSS background-image
), as far as I can tell.itsmatteomanf
12/07/2020, 2:00 AMJames
12/07/2020, 2:09 AMFetchEvent
like that? Trying to reconstruct a FetchEvent
myself to hackily work around this throws a Illegal constructor
error 😦itsmatteomanf
12/07/2020, 2:10 AMJames
12/07/2020, 2:13 AMformat=auto
and format=avif
. I'd prefer to statically do this though on my very static Workers sites,. Hopefully there'll be a resolution on this issue. This definitely used to be possible in older versions of kv-asset-handler
, but was originally changed in https://github.com/cloudflare/kv-asset-handler/commit/c97b8ddf118b8711bc1cc9408461a1c47a1843be it seems.James
12/07/2020, 2:14 AMmapRequestToAsset
couldn't be called on every request if it's explicitly passed into options
- it would seem logical to me to allow this.itsmatteomanf
12/07/2020, 2:16 AMitsmatteomanf
12/07/2020, 2:22 AMJames
12/07/2020, 2:25 AMgetAssetFromKV
function, switch up the Object.assign
at the top for defaults, handling `mapRequestToAsset`'s default more manually. And then below when assigning requestKey
, check if options.getAssetFromKV
was explicitly passed in (not from default), and if so use that, else do the existing behaviour.Rodney
12/07/2020, 2:26 AMitsmatteomanf
12/07/2020, 2:27 AMcatgirl
12/07/2020, 4:14 PMcatgirl
12/07/2020, 4:14 PMalbert-zhao
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:15 PMcatgirl
12/07/2020, 4:16 PMDomain Name: paste.cx
Registry Domain ID: 1862755-CoCCA
Registry WHOIS Server:: whois.coccaregistry.org
Updated Date: 2020-12-07T16:11:19.712Z
Creation Date: 2020-12-07T16:07:54.36Z
Registry Expiry Date: 2021-12-07T16:07:54.99Z
Registrar Registration Expiration Date: 2021-12-07T16:07:54.99Z
albert-zhao
12/07/2020, 4:17 PMcatgirl
12/07/2020, 4:17 PMcatgirl
12/07/2020, 4:17 PMcatgirl
12/07/2020, 4:18 PMalbert-zhao
12/07/2020, 4:18 PMitsmatteomanf
12/07/2020, 4:18 PMitsmatteomanf
12/07/2020, 4:20 PMcatgirl
12/07/2020, 4:23 PMitsmatteomanf
12/07/2020, 4:25 PM