samwaugh commited on
Commit
7e0c9d7
·
1 Parent(s): f5bc4f1

Try to fix logo

Browse files
Files changed (1) hide show
  1. backend/runner/app.py +18 -17
backend/runner/app.py CHANGED
@@ -164,6 +164,24 @@ def serve_js(filename):
164
  print(f"Error serving JS file {filename}: {e}")
165
  return "Internal server error", 500
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  @app.route("/images/<path:filename>")
168
  def serve_images(filename):
169
  """Serve image files."""
@@ -534,23 +552,6 @@ def heatmap():
534
  # --------------------------------------------------------------------------- #
535
  # NEW: marker-output image helpers #
536
  # --------------------------------------------------------------------------- #
537
- @app.route("/images/<work_id>", methods=["GET"])
538
- def list_work_images(work_id: str):
539
- """
540
- Return absolute URLs for all JPEG / PNG images that belong to <work_id>.
541
- """
542
- img_dir = MARKER_DIR / work_id
543
- if not img_dir.is_dir():
544
- return jsonify([])
545
-
546
- files = sorted(
547
- f for f in img_dir.iterdir() if f.suffix.lower() in (".jpg", ".jpeg", ".png")
548
- )
549
- host = request.host_url.rstrip("/")
550
- urls = [f"{host}/marker/{work_id}/{f.name}" for f in files]
551
- return jsonify(urls)
552
-
553
-
554
  @app.route("/marker/<work_id>/<path:filename>", methods=["GET"])
555
  def serve_marker_image(work_id: str, filename: str):
556
  """
 
164
  print(f"Error serving JS file {filename}: {e}")
165
  return "Internal server error", 500
166
 
167
+ # Move this route BEFORE the general images route
168
+ @app.route("/images/<work_id>", methods=["GET"])
169
+ 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(
178
+ f for f in img_dir.iterdir() if f.suffix.lower() in (".jpg", ".jpeg", ".png")
179
+ )
180
+ host = request.host_url.rstrip("/")
181
+ urls = [f"{host}/marker/{work_id}/{f.name}" for f in files]
182
+ return jsonify(urls)
183
+
184
+ # This should come AFTER the more specific route
185
  @app.route("/images/<path:filename>")
186
  def serve_images(filename):
187
  """Serve image files."""
 
552
  # --------------------------------------------------------------------------- #
553
  # NEW: marker-output image helpers #
554
  # --------------------------------------------------------------------------- #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  @app.route("/marker/<work_id>/<path:filename>", methods=["GET"])
556
  def serve_marker_image(work_id: str, filename: str):
557
  """