Skip to content
Snippets Groups Projects
Commit 52d56b88 authored by Dimitris Frangiadakis's avatar Dimitris Frangiadakis Committed by Nicola
Browse files

csv: add max filesize check (#171)

* csv: add max filesize check
parent ba0d9e3e
Branches
No related tags found
No related merge requests found
......@@ -20,6 +20,12 @@ previewable_extensions = ["csv", "dsv"]
def validate_csv(file):
"""Return dialect information about given csv file."""
max_file_size = current_app.config.get(
"PREVIEWER_MAX_FILE_SIZE_BYTES", 10 * 1024 * 1024
)
if file.size > max_file_size:
return False
try:
# Detect encoding and dialect
with file.open() as fp:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment