Skip to content

Fix code scanning alert no. 21: Uncontrolled data used in path expression #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
Loading