Commit 9841abc6 authored by jkvis's avatar jkvis

Filename prefix

parent 2678d473
......@@ -167,7 +167,10 @@ def initiate_transfer(user):
# Try to generate a unique hash for this transfer.
for _ in range(app.config['KEY_GEN_TRIES']):
tid = binascii.b2a_hex(os.urandom(app.config['KEY_LENGTH'] / 2))
transfer = Transfer(tid, metadata['title'], user)
title = 'Transfer'
if 'title' in metadata:
title = metadata['title']
transfer = Transfer(tid, title, user)
# Add a new transfer.
try:
......@@ -180,6 +183,8 @@ def initiate_transfer(user):
meta_file['filename']):
return jsonify({'error': 'invalid metadata'}), 400
meta_file['filename'] = tid + '/' + meta_file['filename']
db.session.add(MetaFile(meta_file['filename'],
meta_file['md5'],
transfer))
......
Markdown is supported
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