Skip to content

Commit

Permalink
#25 feat: 페이지로 메타데이터 얻는 메서드 내에 디코딩 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinno321 committed Sep 30, 2024
1 parent b154d65 commit a81d51f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public ResponseEntity<byte[]> getPdf(
@Parameter(description = "pdf 파일 경로",required = true)
@RequestParam("pdfUrl") String pdfUrl) {
try {
System.out.println("pdfUrl = " + pdfUrl);
byte[] pdfData = s3StorageService.getPdf(pdfUrl).readAllBytes();
return ResponseEntity.ok().contentType(MediaType.APPLICATION_PDF).body(pdfData);
} catch (IOException e) {
Expand Down Expand Up @@ -134,6 +133,7 @@ public ResponseEntity<String> getMetadata(
@Parameter(description = "페이지 번호",required = true)
@RequestParam int page) {
String metadata = s3StorageService.getMetadataForPage(pdfUrl, page);

return ResponseEntity.ok().body(metadata);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,12 @@ public String getMetadataForPage(String pdfUrl, int pageNumber) {
GetObjectResponse getObjectResponse = s3Client.getObject(getRequest).response();

Map<String, String> metadata = getObjectResponse.metadata();
HashMap<String, String> decodedMetadata = decodeMetadata(metadata);
System.out.println("decodedMetadata = " + decodedMetadata);

String pageKey = "page-" + pageNumber;

String result = metadata.get(pageKey);
String result = decodedMetadata.get(pageKey);

// 내용 부분만 추출
if (result != null && result.contains(":")) {
Expand Down

0 comments on commit a81d51f

Please sign in to comment.