Skip to content

Commit

Permalink
Needs Immediate Error Uploading 1.7 GB file
Browse files Browse the repository at this point in the history
Refactored to return error immedidatly if
data file is too large.

Close #340
  • Loading branch information
vchendrix committed Jul 21, 2021
1 parent a743c36 commit 5df89a0
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 207 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Run the development server. Test users/passes are: `superadmin/ngeet2016`, `admi
These instructions assume that you have [Docker](#docker) installed.

### Create environment file
Copy `env.copyme` as `.env` and put your sensitive information in
Copy `env.copyme` as `.env` and put your sensitive informaticon in
there. If you don't know what this is, ask another developer.

### <a name="docker"></a>Docker Configuration
Expand Down
7 changes: 6 additions & 1 deletion archive_api/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def determine_metadata(self, request, view):

data = super(DataSetMetadata, self).determine_metadata(request, view)

max_file_length = request.user.has_perm("archive_api.upload_large_file_dataset") and \
settings.ARCHIVE_API['DATASET_ADMIN_MAX_UPLOAD_SIZE'] or \
settings.ARCHIVE_API['DATASET_USER_MAX_UPLOAD_SIZE']

for x, y in view.__class__.__dict__.items():
if type(y) == FunctionType and hasattr(y, "detail"):
data.setdefault("actions", OrderedDict())
Expand All @@ -71,7 +75,8 @@ def determine_metadata(self, request, view):
upload_route = data["actions"]["upload"]
upload_route["parameters"] = {"attachment": {
"type": "file",
"required": True
"required": True,
"max_length": max_file_length
}}

return data
Expand Down
Loading

0 comments on commit 5df89a0

Please sign in to comment.