From 3f75a2d3a63d524f64bdd908e5375fc9bf093f17 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 4 Jan 2018 09:28:03 -0500 Subject: [PATCH] Re-work upload clarification from #5206. See post-merge discussion on that issue. --- lib/galaxy/tools/actions/upload_common.py | 2 +- tools/data_source/upload.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/tools/actions/upload_common.py b/lib/galaxy/tools/actions/upload_common.py index ae70cae17de..0252443dc2c 100644 --- a/lib/galaxy/tools/actions/upload_common.py +++ b/lib/galaxy/tools/actions/upload_common.py @@ -448,7 +448,7 @@ def create_paramfile(trans, uploaded_datasets): auto_decompress=getattr(uploaded_dataset, "auto_decompress", True), purge_source=purge_source, space_to_tab=uploaded_dataset.space_to_tab, - run_as_real_user=trans.app.config.external_chown_script is None, + run_as_real_user=trans.app.config.external_chown_script is not None, check_content=trans.app.config.check_upload_content, path=uploaded_dataset.path) # TODO: This will have to change when we start bundling inputs. diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 780620313ae..51371f43b01 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -96,10 +96,12 @@ def add_file(dataset, registry, json_file, output_path): # if running as the real user so the file can be cleaned up by Galaxy. purge_source = dataset.get('purge_source', True) and not run_as_real_user - # in_place is True only if we are running as a real user and not importing external paths (i.e. + # in_place is True unless we are running as a real user or importing external paths (i.e. # this is a real upload and not a path paste or ftp import). - # In this case we try to reuse the uploaded file that has been chowned to this user already. - in_place = run_as_real_user and dataset.type not in ('server_dir', 'path_paste', 'ftp_import') + # in_place should always be False if running as real user because the uploaded file will + # be owned by Galaxy and not the user and it should be False for external paths so Galaxy doesn't + # modify files not controlled by Galaxy. + in_place = not run_as_real_user and dataset.type not in ('server_dir', 'path_paste', 'ftp_import') # Base on the check_upload_content Galaxy config option and on by default, this enables some # security related checks on the uploaded content, but can prevent uploads from working in some cases.