Correction finale route Media FastHTML
Build and Push Docker Image / build-and-push (push) Successful in 36s

This commit is contained in:
xavier committed 2026-08-26 19:57:30 +02:00
1 parent 26bc8483c6
commit 937e877ee2
1 file changed
+5 -5
+5 -5
View File
@@ -50,16 +50,16 @@ app, rt = fast_app(
app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo") app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo")
# --- LECTURE DIRECTE EN RAM (Contournement du bug FastHTML & RAID) --- # --- LECTURE EN RAM (Syntaxe Native FastHTML) ---
@app.get("/Media/{fname:path}") @rt('/Media/{fname}')
def get_media(fname: str): def get(fname: str):
chemin = os.path.join(dossier_media, fname) chemin = os.path.join(dossier_media, fname)
try: try:
# Lecture binaire brute qui ignore les caprices de métadonnées du disque
with open(chemin, "rb") as f: with open(chemin, "rb") as f:
return Response(content=f.read(), media_type="image/png") return Response(content=f.read(), media_type="image/png")
except Exception as e: 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 --- # --- ROUTES D'AUTHENTIFICATION ---
@rt('/login') @rt('/login')