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:
@@ -8,7 +8,7 @@ import threading
|
|||||||
from email.header import decode_header
|
from email.header import decode_header
|
||||||
from PyQt6.QtCore import QObject, pyqtSignal
|
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"}
|
ALLOWED_EXTENSIONS = {"jpg", "jpeg", "png", "bmp", "tiff", "tif", "webp", "heic"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import queue
|
|||||||
from flask import Flask, request, jsonify, render_template_string
|
from flask import Flask, request, jsonify, render_template_string
|
||||||
from PyQt6.QtCore import QObject, pyqtSignal, QTimer
|
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"}
|
ALLOWED_EXTENSIONS = {"jpg", "jpeg", "png", "bmp", "tiff", "tif", "webp", "heic"}
|
||||||
|
|
||||||
UPLOAD_PAGE = """<!DOCTYPE html>
|
UPLOAD_PAGE = """<!DOCTYPE html>
|
||||||
@@ -311,7 +311,7 @@ class UploadServer:
|
|||||||
continue
|
continue
|
||||||
# Nom unique basé sur le timestamp
|
# Nom unique basé sur le timestamp
|
||||||
name = f"{int(time.time() * 1000)}_{f.filename}"
|
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)
|
f.save(path)
|
||||||
saved.append(path)
|
saved.append(path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user