Skip to content

Commit

Permalink
Merge pull request #52 from KOSASIH/deepsource-transform-97da41db
Browse files Browse the repository at this point in the history
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
  • Loading branch information
KOSASIH authored May 11, 2024
2 parents 33a2129 + e8b0ad0 commit ebcb701
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/utils/helpers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Helper utilities
import os


def send_file(file, as_attachment=True):
if as_attachment:
return send_file_from_directory(file, as_attachment=True)
return send_file_from_memory(file)


def send_file_from_directory(file, as_attachment=True):
file_path = os.path.join(current_app.config['UPLOAD_FOLDER'], file)
return send_from_directory(current_app.config['UPLOAD_FOLDER'], file, as_attachment=as_attachment)
file_path = os.path.join(current_app.config["UPLOAD_FOLDER"], file)
return send_from_directory(
current_app.config["UPLOAD_FOLDER"], file, as_attachment=as_attachment
)


def send_file_from_memory(file):
return send_file(file, mimetype='application/octet-stream', as_attachment=True)
return send_file(file, mimetype="application/octet-stream", as_attachment=True)

0 comments on commit ebcb701

Please sign in to comment.