cloudflare / cloudflare/workerd

🐛 Bug Report — Runtime APIs Pages env.ASSET.fetch rewrites html absolute paths to be relitive

Open
#1,296 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

This is weird

Setup:

i have public/chatSAP.html

i have /functions/chat/deep/route

i call something like this
```js
//early out if not post method
if(method === "GET") {
//todo the _routes should do this i think;
Request.url = req.url.replace("/"+path, "SAP.html" )
//Here we are rewriting the url on get request
return env.ASSETS.fetch(req )
} else if(method !== "POST") {
return errorResponse("Must POST JSON | GET PAGE")
}

```

My page that renders properly and inspecting html I see my assets with absolute paths `/js/script.js`

gets replaced with `./js/script.js`

this breaks my Pages app. I have tried forcing the new asset in a git push and also purge everything site cache

No luck THIS IS NOT A FEATURE ;)

Probably a weird one as its replacing`"/some/path"` at the beginning of an html path with `"./some/path"`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.