윤창목

Fixed key issue

...@@ -195,14 +195,14 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -195,14 +195,14 @@ class ItemViewSet(viewsets.ViewSet):
195 s3_bucket = AWS_STORAGE_BUCKET_NAME 195 s3_bucket = AWS_STORAGE_BUCKET_NAME
196 196
197 item = Item.objects.filter(item_id=pk) 197 item = Item.objects.filter(item_id=pk)
198 - object_id = item.get().item_id 198 + object_name = item.get().name
199 data = serializers.serialize("json", item) 199 data = serializers.serialize("json", item)
200 json_data = json.loads(data) 200 json_data = json.loads(data)
201 201
202 presigned_url = s3.generate_presigned_url( 202 presigned_url = s3.generate_presigned_url(
203 'get_object', 203 'get_object',
204 Params={'Bucket': s3_bucket, 204 Params={'Bucket': s3_bucket,
205 - 'Key': object_id}, 205 + 'Key': object_name},
206 ExpiresIn=3600 206 ExpiresIn=3600
207 ) 207 )
208 208
...@@ -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)
......