Public Access
Correction finale route Media FastHTML
Build and Push Docker Image / build-and-push (push) Successful in 36s
Build and Push Docker Image / build-and-push (push) Successful in 36s
This commit is contained in:
1 parent
26bc8483c6
commit
937e877ee2
1 file changed
+5
-5
@@ -50,16 +50,16 @@ app, rt = fast_app(
|
||||
|
||||
app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo")
|
||||
|
||||
# --- LECTURE DIRECTE EN RAM (Contournement du bug FastHTML & RAID) ---
|
||||
@app.get("/Media/{fname:path}")
|
||||
def get_media(fname: str):
|
||||
# --- LECTURE EN RAM (Syntaxe Native FastHTML) ---
|
||||
@rt('/Media/{fname}')
|
||||
def get(fname: str):
|
||||
chemin = os.path.join(dossier_media, fname)
|
||||
try:
|
||||
# Lecture binaire brute qui ignore les caprices de métadonnées du disque
|
||||
with open(chemin, "rb") as f:
|
||||
return Response(content=f.read(), media_type="image/png")
|
||||
except Exception as e:
|
||||
return HTMLResponse(f"<h1 style='color:red;'>Erreur interne: {e}</h1>", status_code=404)
|
||||
# Si ça plante ici, ça renverra une erreur 500 visible, PAS un 404 silencieux !
|
||||
return HTMLResponse(f"<h1 style='color:red;'>Erreur RAM: {e}</h1>", status_code=500)
|
||||
|
||||
# --- ROUTES D'AUTHENTIFICATION ---
|
||||
@rt('/login')
|
||||
|
||||
Reference in new issue
Block a user