kotx / render

Cloudflare Worker to proxy and cache requests to R2
MIT License
384 stars 85 forks source link

fix for path without leading slash #27

Closed yankeguo closed 1 year ago

yankeguo commented 1 year ago

I'm using render inside my own route and encountered a strange problem.

It took a long time to find the cause of the problem.

I think it will be better if add a check

Erisa commented 1 year ago

I didn't know it was even possible for a path passed to a Worker to not have a leading slash - curious what kind of scenario causes that to happen?

kotx commented 1 year ago

I'll release a patch version later today Edit: released in 1.1.2

yankeguo commented 1 year ago

@Erisa I rechecked my code, found I missed a leading slash in env.PATH_PREFIX, however I believe this senario should also be covered.

https://github.com/kotx/render/blob/3f3d277cd066fc81b125da0f6286a47f9d5119d2/src/index.ts#L156

Thanks for quick response.