forked from 0x2620/pandora
only get file if we have a chunk
This commit is contained in:
parent
991ef93876
commit
c076579300
1 changed files with 2 additions and 1 deletions
|
@ -275,11 +275,12 @@ def firefogg_upload(request):
|
||||||
@login_required_json
|
@login_required_json
|
||||||
def direct_upload(request):
|
def direct_upload(request):
|
||||||
if 'id' in request.GET:
|
if 'id' in request.GET:
|
||||||
file = models.File.objects.get(oshash=request.GET['id'])
|
oshash = request.GET['id']
|
||||||
else:
|
else:
|
||||||
oshash = request.POST['id']
|
oshash = request.POST['id']
|
||||||
response = json_response(status=400, text='this request requires POST')
|
response = json_response(status=400, text='this request requires POST')
|
||||||
if 'chunk' in request.FILES:
|
if 'chunk' in request.FILES:
|
||||||
|
file = models.File.objects.get(oshash=oshash)
|
||||||
if file.editable(request.user):
|
if file.editable(request.user):
|
||||||
response = process_chunk(request, file.save_chunk)
|
response = process_chunk(request, file.save_chunk)
|
||||||
response['resultUrl'] = request.build_absolute_uri(file.item.get_absolute_url())
|
response['resultUrl'] = request.build_absolute_uri(file.item.get_absolute_url())
|
||||||
|
|
Loading…
Reference in a new issue