File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1006,14 +1006,17 @@ def persistent_file_download(auth, **kwargs):
1006
1006
file = BaseFileNode .active .filter (_id = id_or_guid ).first ()
1007
1007
if not file :
1008
1008
guid = Guid .load (id_or_guid )
1009
- if guid :
1010
- referent = guid .referent
1011
- file = referent .primary_file if type (referent ) is Preprint else referent
1012
- else :
1009
+ if not guid :
1013
1010
raise HTTPError (http_status .HTTP_404_NOT_FOUND , data = {
1014
1011
'message_short' : 'File Not Found' ,
1015
1012
'message_long' : 'The requested file could not be found.'
1016
1013
})
1014
+
1015
+ file = guid .referent
1016
+ if type (file ) is Preprint :
1017
+ referent , _ = Guid .load_referent (id_or_guid )
1018
+ file = referent .primary_file
1019
+
1017
1020
if not file .is_file :
1018
1021
raise HTTPError (http_status .HTTP_400_BAD_REQUEST , data = {
1019
1022
'message_long' : 'Downloading folders is not permitted.'
You can’t perform that action at this time.
0 commit comments