Fix chemins photos : abspath pour éviter les ../.. dans les paths

QPixmap ne charge pas les fichiers avec des chemins relatifs contenant ..

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 23:09:39 +01:00
parent daeb760fe7
commit 380adef814
2 changed files with 3 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ import threading
from email.header import decode_header
from PyQt6.QtCore import QObject, pyqtSignal
UPLOAD_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "data", "photos")
UPLOAD_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "data", "photos"))
ALLOWED_EXTENSIONS = {"jpg", "jpeg", "png", "bmp", "tiff", "tif", "webp", "heic"}

View File

@@ -7,7 +7,7 @@ import queue
from flask import Flask, request, jsonify, render_template_string
from PyQt6.QtCore import QObject, pyqtSignal, QTimer
UPLOAD_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "data", "photos")
UPLOAD_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "data", "photos"))
ALLOWED_EXTENSIONS = {"jpg", "jpeg", "png", "bmp", "tiff", "tif", "webp", "heic"}
UPLOAD_PAGE = """<!DOCTYPE html>
@@ -311,7 +311,7 @@ class UploadServer:
continue
# Nom unique basé sur le timestamp
name = f"{int(time.time() * 1000)}_{f.filename}"
path = os.path.join(UPLOAD_DIR, name)
path = os.path.abspath(os.path.join(UPLOAD_DIR, name))
f.save(path)
saved.append(path)