-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: 문의 관련 첨부파일 public 으로 변경 #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,21 +64,21 @@ public void updateAttachment( | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private InquiryDetailResponse.AttachmentResponse createAttachResponse( | ||||||||||||||||||||||||||||||||
| InquiryAnswerAttachmentEntity attachment) { | ||||||||||||||||||||||||||||||||
| String preSignedUrl = s3Service.getPreSignedUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
| String publicUrl = s3Service.getPublicUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return new InquiryDetailResponse.AttachmentResponse( | ||||||||||||||||||||||||||||||||
| attachment.getFileName(), | ||||||||||||||||||||||||||||||||
| preSignedUrl | ||||||||||||||||||||||||||||||||
| publicUrl | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+67
to
72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainPublic URL switch: ensure legacy attachments won’t break Same concern as for inquiry attachments. Existing inquiry-answer attachments stored as PRIVATE will fail if we now return public URLs. Plan for either (a) data migration to PUBLIC or (b) a temporary conditional URL strategy based on entity visibility. To reduce risk of dead code and ensure consistency, please also verify whether createAttachResponse(...) is used anywhere: I can provide a visibility-aware S3Service.getUrl(visibility, key) shim if you want a transitional solution. Also applies to: 77-83 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Check for lingering pre-signed URL usage"
rg -n "getPreSignedUrl\\("
echo
echo "Is createAttachResponse referenced?"
rg -n "createAttachResponse\\("Length of output: 986 Handle PRIVATE inquiry-answer attachments to prevent broken URLs Verified that the private • Files to update: • Suggested changes:
public String getUrl(Visibility visibility, String s3Key) {
return visibility == Visibility.PUBLIC
? getPublicUrl(s3Key)
: getPreSignedUrl(s3Key);
}
- String publicUrl = s3Service.getPublicUrl(attachment.getS3Key());
+ String url = s3Service.getUrl(attachment.getVisibility(), attachment.getS3Key());
return new InquiryDetailResponse.AttachmentResponse(
attachment.getFileName(),
- publicUrl
+ url
);Alternatively, if you prefer not to introduce a shim, inline the conditional: String url = attachment.getVisibility() == Visibility.PUBLIC
? s3Service.getPublicUrl(key)
: s3Service.getPreSignedUrl(key);This ensures PRIVATE attachments continue working until you migrate them to PUBLIC. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private InquiryDetailResponse.AttachmentDetailResponse createAttachDetailResponse( | ||||||||||||||||||||||||||||||||
| InquiryAnswerAttachmentEntity attachment) { | ||||||||||||||||||||||||||||||||
| String preSignedUrl = s3Service.getPreSignedUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
| String publicUrl = s3Service.getPublicUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return new InquiryDetailResponse.AttachmentDetailResponse( | ||||||||||||||||||||||||||||||||
| attachment.getFileName(), | ||||||||||||||||||||||||||||||||
| preSignedUrl, | ||||||||||||||||||||||||||||||||
| publicUrl, | ||||||||||||||||||||||||||||||||
| attachment.getS3Key() | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+77
to
83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,11 +60,11 @@ public List<InquiryDetailResponse.AttachmentDetailResponse> toAttachmentResponse | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private InquiryDetailResponse.AttachmentDetailResponse createAttachDetailResponse( | ||||||||||||||||||||||||||||||||
| InquiryAttachmentJpaEntity attachment) { | ||||||||||||||||||||||||||||||||
| String preSignedUrl = s3Service.getPreSignedUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
| String publicUrl = s3Service.getPublicUrl(attachment.getS3Key()); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return new InquiryDetailResponse.AttachmentDetailResponse( | ||||||||||||||||||||||||||||||||
| attachment.getFileName(), | ||||||||||||||||||||||||||||||||
| preSignedUrl, | ||||||||||||||||||||||||||||||||
| publicUrl, | ||||||||||||||||||||||||||||||||
| attachment.getS3Key() | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+63
to
69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Comment on lines
+63
to
69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainSwitch to public URL: confirm migration/backward-compat for existing private objects Changing from pre-signed to public URLs works for newly created PUBLIC objects, but existing inquiry attachments previously stored as PRIVATE will 403 if not migrated. Please either:
You can quickly check whether the attachment entities carry a visibility field we can branch on, and whether any lingering usages of getPreSignedUrl() remain: If helpful, I can draft a one-off migration plan (DB update + S3 ACL/object metadata update via prefix) and a temporary dual-path resolver in S3Service. 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Find visibility on inquiry attachment entities"
rg -n -A 5 -B 2 $'class InquiryAttachmentJpaEntity|visibility|getVisibility\\('
echo
echo "Find any remaining usages of pre-signed URL API"
rg -n "getPreSignedUrl\\("Length of output: 27648 Handle private inquiry attachments by branching on visibility or migrating
Either approach prevents 403s for legacy private files. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3Service에 파일의 공개 여부에 따라 적절한 URL(public 또는 pre-signed)을 반환하는getUrl(File file)메서드가 있습니다.getPublicUrl을 직접 호출하는 대신s3Service.getUrl(attachment)를 사용하면 향후 가시성 정책이 변경되더라도 이 코드를 수정할 필요가 없어 유지보수성이 향상됩니다.