File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,14 @@ def get_image(file: UploadFile = File(...)) -> JSONResponse:
5353 """
5454 if not file .filename :
5555 return JSONResponse (
56- content = {"error" : "No uploaded file" },
56+ content = {"error" : "No filename provided in uploaded file" },
5757 status_code = status .HTTP_400_BAD_REQUEST ,
5858 )
5959
6060 # 画像のファイル名の取得
6161 file_name = file .filename
6262
63- # etrobocon2025-comm-device-system> image_dataに画像を保存
63+ # etrobocon2025-comm-device-system\ image_dataに画像を保存
6464 project_root = os .path .dirname (os .path .dirname (os .path .dirname (__file__ )))
6565 image_data_dir = os .path .join (project_root , 'image_data' )
6666
@@ -83,24 +83,18 @@ def get_image(file: UploadFile = File(...)) -> JSONResponse:
8383 if upload_success :
8484 return JSONResponse (
8585 content = {
86- "message" : (
87- "File uploaded successfully to both local and "
88- "official system"
89- ),
86+ "message" : "File uploaded successfully" ,
9087 "filePath" : file_path
9188 },
9289 status_code = status .HTTP_200_OK
9390 )
9491 else :
9592 return JSONResponse (
9693 content = {
97- "message" : (
98- "File uploaded to local but failed to upload to "
99- "official system"
100- ),
94+ "error" : "File saved locally but failed to upload to official system" ,
10195 "filePath" : file_path
10296 },
103- status_code = status .HTTP_207_MULTI_STATUS
97+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR
10498 )
10599
106100
You can’t perform that action at this time.
0 commit comments