mirror of
https://github.com/headporter81/specialsource-homepage-backend.git
synced 2026-12-06 07:41:09 +09:00
fix : 업로드 조각 저장 실패 시 원인을 응답에 담아 화면에 표시
SpecialSource Backend CI/CD / build-and-deploy (push) Successful in 55s
SpecialSource Backend CI/CD / build-and-deploy (push) Successful in 55s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
90cbedb1bb
commit
1fd7d581bd
1 file changed
+6
@@ -158,6 +158,7 @@ public class MediaPostController {
|
|||||||
return ResponseEntity.badRequest().body(Map.of("error", "잘못된 업로드 요청입니다"));
|
return ResponseEntity.badRequest().body(Map.of("error", "잘못된 업로드 요청입니다"));
|
||||||
}
|
}
|
||||||
Path temp = uploadDir(uploadId);
|
Path temp = uploadDir(uploadId);
|
||||||
|
try {
|
||||||
Files.createDirectories(temp);
|
Files.createDirectories(temp);
|
||||||
Path part = temp.resolve(String.valueOf(fileIndex));
|
Path part = temp.resolve(String.valueOf(fileIndex));
|
||||||
try (java.nio.channels.FileChannel ch = java.nio.channels.FileChannel.open(part,
|
try (java.nio.channels.FileChannel ch = java.nio.channels.FileChannel.open(part,
|
||||||
@@ -168,6 +169,11 @@ public class MediaPostController {
|
|||||||
}
|
}
|
||||||
// 다 쓴 뒤에 표시 → 표시가 있으면 그 조각은 확실히 들어감
|
// 다 쓴 뒤에 표시 → 표시가 있으면 그 조각은 확실히 들어감
|
||||||
Files.write(temp.resolve(fileIndex + "." + chunkIndex + ".ok"), new byte[0]);
|
Files.write(temp.resolve(fileIndex + "." + chunkIndex + ".ok"), new byte[0]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 서버 로그를 바로 못 보는 환경이라 원인을 화면까지 전달 (로그인한 사용자만 호출 가능)
|
||||||
|
e.printStackTrace();
|
||||||
|
return ResponseEntity.status(500).body(Map.of("error", "조각 저장 실패: " + e));
|
||||||
|
}
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user