KV Assets (site bucket) __STATIC_CONTENT is are suffixed with hashes (05c5fa8db8)

Hi all,

We're trying to use a workers sites bucket defined in our API wrangler to host some (temporary) image assets in to show in our app, but once we attempt to fetch these we see that they are suffixed with hashes. What is the recommended way to continue here so we can access assets in these buckets through e.g. /public/some-temp-image.png? We use getAssetFromKV:

    return await getAssetFromKV(
      {
        request: ctx.req.raw,
        waitUntil: ctx.executionCtx.waitUntil.bind(ctx.executionCtx),
      },
      {
        ASSET_NAMESPACE: ctx.env.__STATIC_CONTENT,
        mapRequestToAsset: (req) => {
          const url = new URL(req.url);
          url.pathname = url.pathname.replace(/^\/public/, "");
          return new Request(url.toString(), req);
        },
      },
    );
  } catch (e) {
    if (e instanceof Error) {
      console.error(e);
      if ("status" in e) {
        if (e.status === 404) {
          return ctx.notFound();
        }
      }
    }
    throw e;
  }



Can we skip workers sites from adding these hashes?
Was this page helpful?