윤창목

commit fixed views.py

...@@ -398,6 +398,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -398,6 +398,7 @@ class ItemViewSet(viewsets.ViewSet):
398 # 파일 객체 생성 398 # 파일 객체 생성
399 file_name = request.POST.get('name', '') 399 file_name = request.POST.get('name', '')
400 file_size = request.POST.get('size', '') 400 file_size = request.POST.get('size', '')
401 + file_id = request.POST.get('item_id', '')
401 file_parent = pk 402 file_parent = pk
402 file_type = mimetypes.guess_type(file_name)[0] 403 file_type = mimetypes.guess_type(file_name)[0]
403 upload_item = Item(name=file_name, size=file_size, user_id=1, file_type=file_type, parent=file_parent) 404 upload_item = Item(name=file_name, size=file_size, user_id=1, file_type=file_type, parent=file_parent)
...@@ -407,7 +408,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -407,7 +408,7 @@ class ItemViewSet(viewsets.ViewSet):
407 408
408 presigned_post = s3.generate_presigned_post( 409 presigned_post = s3.generate_presigned_post(
409 s3_bucket, 410 s3_bucket,
410 - file_name, 411 + file_id,
411 { 412 {
412 "acl": "private", 413 "acl": "private",
413 "Content-Type": file_type, 414 "Content-Type": file_type,
...@@ -434,7 +435,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -434,7 +435,7 @@ class ItemViewSet(viewsets.ViewSet):
434 435
435 data = { 436 data = {
436 "signed_url": presigned_post, 437 "signed_url": presigned_post,
437 - 'url': '%s/%s' % (presigned_post["url"], file_name), 438 + 'url': '%s/%s' % (presigned_post["url"], file_id),
438 'item': res 439 'item': res
439 } 440 }
440 441
......