Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/api/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"""This module defines the API routes for file management."""

from flask import Blueprint, jsonify, request, send_file
from werkzeug.utils import secure_filename
from google.cloud import storage
import os
from api.auth import auth
Expand Down Expand Up @@ -74,7 +75,8 @@ def download_file(filename):
return jsonify({"error": f"File '{filename}' not found"}), 404

# Create a temporary file to store the downloaded content
temp_filename = f"/tmp/{filename}"
safe_filename = secure_filename(filename)
temp_filename = os.path.join("/tmp", safe_filename)
blob.download_to_filename(temp_filename)

# Send the downloaded file to the client
Expand Down