Debugging for logo
Browse files- backend/runner/app.py +17 -1
backend/runner/app.py
CHANGED
|
@@ -170,8 +170,10 @@ def list_work_images(work_id: str):
|
|
| 170 |
"""
|
| 171 |
Return absolute URLs for all JPEG / PNG images that belong to <work_id>.
|
| 172 |
"""
|
|
|
|
| 173 |
img_dir = MARKER_DIR / work_id
|
| 174 |
if not img_dir.is_dir():
|
|
|
|
| 175 |
return jsonify([])
|
| 176 |
|
| 177 |
files = sorted(
|
|
@@ -185,8 +187,22 @@ def list_work_images(work_id: str):
|
|
| 185 |
@app.route("/images/<path:filename>")
|
| 186 |
def serve_images(filename):
|
| 187 |
"""Serve image files."""
|
|
|
|
| 188 |
images_dir = Path(__file__).parent.parent.parent / "frontend" / "images"
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
|
| 192 |
@app.route("/presign", methods=["POST"])
|
|
|
|
| 170 |
"""
|
| 171 |
Return absolute URLs for all JPEG / PNG images that belong to <work_id>.
|
| 172 |
"""
|
| 173 |
+
print(f"π list_work_images called with work_id: {work_id}")
|
| 174 |
img_dir = MARKER_DIR / work_id
|
| 175 |
if not img_dir.is_dir():
|
| 176 |
+
print(f"β Work directory not found: {img_dir}")
|
| 177 |
return jsonify([])
|
| 178 |
|
| 179 |
files = sorted(
|
|
|
|
| 187 |
@app.route("/images/<path:filename>")
|
| 188 |
def serve_images(filename):
|
| 189 |
"""Serve image files."""
|
| 190 |
+
print(f"π serve_images called with filename: {filename}")
|
| 191 |
images_dir = Path(__file__).parent.parent.parent / "frontend" / "images"
|
| 192 |
+
print(f"π Images directory: {images_dir}")
|
| 193 |
+
print(f"π Images directory exists: {images_dir.exists()}")
|
| 194 |
+
print(f"π Looking for file: {images_dir / filename}")
|
| 195 |
+
print(f"π File exists: {(images_dir / filename).exists()}")
|
| 196 |
+
|
| 197 |
+
if not images_dir.exists():
|
| 198 |
+
return "Images directory not found", 404
|
| 199 |
+
|
| 200 |
+
if not (images_dir / filename).exists():
|
| 201 |
+
return f"Image file {filename} not found", 404
|
| 202 |
+
|
| 203 |
+
mime, _ = guess_type(filename)
|
| 204 |
+
print(f"π MIME type: {mime}")
|
| 205 |
+
return send_from_directory(images_dir, filename, mimetype=mime)
|
| 206 |
|
| 207 |
|
| 208 |
@app.route("/presign", methods=["POST"])
|