AnswerDotAI / fasthtml

The fastest way to create an HTML app
https://fastht.ml/
Apache License 2.0
5.27k stars 219 forks source link

[BUG] ext:static in route doesn't work #348

Closed samueller closed 1 month ago

samueller commented 1 month ago

Docs show the following code for changing static media file locations:

@rt("/{fname:path}.{ext:static}")
async def get(fname:str, ext:str): 
    return FileResponse(f'public/{fname}.{ext}')

I added that route and put my static content in public/, but I only got Not Founds. When I remove :static from the route decorator, it worked. Was :static a typo? Also, what is :path?

Environment Information Please provide the following version information:

Confirmation Please confirm the following:

jph00 commented 1 month ago

Please use discussions or discord for help.