Commit 0bdc22d4 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added support for .tar files.

parent 212c1050
......@@ -368,7 +368,7 @@ class Uploads extends React.Component {
'application/zip', 'application/gzip', 'application/bz2', 'application/x-gzip',
'application/x-bz2', 'application/x-gtar', 'application/x-tgz', 'application/tar+gzip',
'application/tar', 'application/tar+bz2']}
'application/x-tar', 'application/tar+bz2']}
......@@ -268,19 +268,20 @@ class UploadListResource(Resource):
if local_path:
# file is already there and does not to be received
upload_path = local_path
elif request.mimetype == 'application/multipart-formdata':
elif request.mimetype in ['multipart/form-data', 'application/multipart-formdata']:'receive upload as multipart formdata')
upload_path = files.PathObject(config.fs.tmp, upload_id).os_path
# multipart formdata, e.g. with curl -X put "url" -F file=@local_file
# might have performance issues for large files:
if 'file' in request.files:
if 'file' not in request.files:
abort(400, message='Bad multipart-formdata, there is no file part.')
file = request.files['file']
if upload_name is None or upload_name is '':
upload_name = file.filename
upload_path = files.PathObject(config.fs.tmp, upload_id).os_path
# simple streaming data in HTTP body, e.g. with curl "url" -T local_file'started to receive upload streaming data')
upload_path = files.PathObject(config.fs.tmp, upload_id).os_path
......@@ -528,4 +529,7 @@ class UploadCommandResource(Resource):
upload_command = 'curl -X PUT -H "X-Token: %s" "%s" -F file=@<local_file>' % (
g.user.get_auth_token().decode('utf-8'), upload_url)
# upload_command = 'curl -H "X-Token: %s" "%s" -T <local_file>' % (
# g.user.get_auth_token().decode('utf-8'), upload_url)
return dict(upload_url=upload_url, upload_command=upload_command), 200
......@@ -395,7 +395,7 @@ class StagingUploadFiles(UploadFiles):
except zipfile.BadZipFile:
if force_archive or ext in ['.tgz', '.tar.gz', '.tar.bz2']:
if force_archive or ext in ['.tgz', '.tar.gz', '.tar.bz2', '.tar']:
with as tf:
......@@ -324,7 +324,9 @@ class TestUploads:
if mode == 'multipart':
rv = client.put(
url, data=dict(file=(open(file, 'rb'), 'file')), headers=test_user_auth)
url, data=dict(file=(open(file, 'rb'), 'the_name')), headers=test_user_auth)
if not name:
name = 'the_name'
elif mode == 'stream':
with open(file, 'rb') as f:
rv = client.put(url,, headers=test_user_auth)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment