Skip to content

Commit

Permalink
fix: 강제 다운로드
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeryboy committed Sep 19, 2023
1 parent efd8803 commit a705015
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ class DeprecatedFileController(
headers.contentType =
org.springframework.http.MediaType.parseMediaType(contentType)

val originalFilename = fileSubDir.substringAfterLast("/")
val encodedFilename = URLEncoder.encode(originalFilename, Charsets.UTF_8.toString()).replace("+", "%20")

headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''$encodedFilename")

ResponseEntity.ok()
.headers(headers)
.body(resource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ class FileController(
if (contentType.startsWith("text")) {
contentType += ";charset=UTF-8"
}

headers.contentType =
org.springframework.http.MediaType.parseMediaType(contentType)

val originalFilename = filename.substringAfter("_")
val encodedFilename = URLEncoder.encode(originalFilename, Charsets.UTF_8.toString()).replace("+", "%20")

headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''$encodedFilename")

return ResponseEntity.ok()
.headers(headers)
.body(resource)
Expand Down

0 comments on commit a705015

Please sign in to comment.