Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
@Getter
public class UploadFileLocation {

private static final String HTTPS_PROTOCOL = "https://";

private final String fileUrl;
private final String fileName;

Expand All @@ -14,13 +16,13 @@ private UploadFileLocation(String fileUrl, String fileName) {
}

public static UploadFileLocation of(String domainName, UploadFile uploadFile) {
return new UploadFileLocation(domainName + UploadFileFullPath.SLASH + uploadFile.getFullPath(),
return new UploadFileLocation(HTTPS_PROTOCOL + domainName + UploadFileFullPath.SLASH + uploadFile.getFullPath(),
uploadFile.getFileName());
}

public static UploadFileLocation of(String domainName, UploadFileFullPath uploadFileFullPath) {
return new UploadFileLocation(domainName + UploadFileFullPath.SLASH + uploadFileFullPath.unixValue(),
return new UploadFileLocation(
HTTPS_PROTOCOL + domainName + UploadFileFullPath.SLASH + uploadFileFullPath.unixValue(),
uploadFileFullPath.getFileFullName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class UploadFileResponse {
@ApiModelProperty(notes = "업로드된 파일 url",
example = "static.koreatech.in/example.png",
example = "https://static.koreatech.in/example.png",
required = true
)
private final String fileUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static class Attachment {
private Integer id;

@ApiModelProperty(notes = "업로드된 파일 url"
, example = "static.koreatech.in/example.png"
, example = "https://static.koreatech.in/example.png"
, required = true
)
private final String fileUrl;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/koreatech/in/service/S3UploadServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
@Service
public class S3UploadServiceImpl implements UploadService {

private static final String HTTPS_PROTOCOL = "https://";

private final S3Util s3Util;
private final String bucketName;
private final String domainUrlPrefix;
Expand Down Expand Up @@ -95,7 +93,7 @@ public PreSignedUrlResponse generatePreSignedUrl(DomainEnum domain, PreSignedUrl
PreSignedUrlResult preSignedUrlResult = s3Util.generatePreSignedUrlForPut(bucketName, uploadFileMetaData,
uploadFileFullPath.unixValue(), new Date());

UploadFileLocation uploadFileLocation = UploadFileLocation.of(HTTPS_PROTOCOL + domainUrlPrefix,
UploadFileLocation uploadFileLocation = UploadFileLocation.of(domainUrlPrefix,
uploadFileFullPath);
return UploadFileConverter.INSTANCE.toPreSignedUrlResponse(preSignedUrlResult, uploadFileLocation);
}
Expand Down