Skip to content

extractAssetSha

function extractAssetSha(url): string | null;

Defined in: packages/asset-client/src/transform.ts:160

Extract the 16-hex short sha from an aquienpz CDN URL, regardless of shape:

  • tenant-prefixed variant: https://8ok.uk/4/v/<sha16>-<preset>.<ext>
  • legacy variant: https://8ok.uk/<sha16>-<preset>.<ext>
  • on-the-fly transform: https://8ok.uk/t/<dsl>/<sha16>.<ext>
  • streaming HLS: https://8ok.uk/t/format=hls/<sha16>.m3u8

Returns null for non-aquienpz URLs (pexels, googleusercontent, raw uploaded URLs to other CDNs) so call sites can fall back to the URL with a plain <img> instead of generating a broken transform URL.

Useful when a value reaches the component as a pre-built URL string (legacy data, site-config JSON, third-party feeds) but you want to drop in getTransformSrcSet for the responsive ladder if it happens to be an aquienpz asset.

Parameter Type
url string | null | undefined

string | null