diff --git a/addons/base/views.py b/addons/base/views.py index d3afdea8de0..6790c194515 100644 --- a/addons/base/views.py +++ b/addons/base/views.py @@ -762,15 +762,6 @@ def addon_view_or_download_file(auth, path, provider, **kwargs): ) ) - # There's no download action redirect to the Ember front-end file view and create guid. - if action != 'download': - if isinstance(target, Node) and waffle.flag_is_active(request, features.EMBER_FILE_PROJECT_DETAIL): - guid = file_node.get_guid(create=True) - return redirect(f'{settings.DOMAIN}{guid._id}/') - if isinstance(target, Registration) and waffle.flag_is_active(request, features.EMBER_FILE_REGISTRATION_DETAIL): - guid = file_node.get_guid(create=True) - return redirect(f'{settings.DOMAIN}{guid._id}/') - if version is None: # File is either deleted or unable to be found in the provider location # Rollback the insertion of the file_node @@ -799,6 +790,15 @@ def addon_view_or_download_file(auth, path, provider, **kwargs): else: transaction.savepoint_commit(savepoint_id) + # There's no download action redirect to the Ember front-end file view and create guid. + if action != 'download': + if isinstance(target, Node) and waffle.flag_is_active(request, features.EMBER_FILE_PROJECT_DETAIL): + guid = file_node.get_guid(create=True) + return redirect(f'{settings.DOMAIN}{guid._id}/') + if isinstance(target, Registration) and waffle.flag_is_active(request, features.EMBER_FILE_REGISTRATION_DETAIL): + guid = file_node.get_guid(create=True) + return redirect(f'{settings.DOMAIN}{guid._id}/') + # TODO clean up these urls and unify what is used as a version identifier if request.method == 'HEAD': return make_response(('', http_status.HTTP_302_FOUND, {