Conversation
Summary of ChangesHello @lingard1234, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 마이 프로필 카드 조회 시 반환되는 SNS 정보를 개선하기 위한 리팩토링입니다. 기존에 전체 SNS URL을 제공하던 방식에서 벗어나, 사용자에게 Instagram 계정 ID만을 명확하게 보여주도록 데이터 형식을 변경하여 응답 DTO의 가독성과 유용성을 높였습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
마이프로필카드 조회 시 SNS URL에서 계정 ID만 추출하도록 리팩터링한 부분을 검토했습니다. extractInstagramAccount 메서드를 추가하여 인스타그램 URL에서 계정명을 추출하는 로직을 구현하셨습니다. 현재 구현은 일부 엣지 케이스에서 의도치 않은 결과를 반환할 수 있어, 정규식을 사용하여 더 견고하게 계정명을 추출하는 방법을 제안드렸습니다. 이 부분은 기존 로직의 정확성을 높이는 중요한 개선 사항으로 판단되어 그대로 유지합니다.
| private static String extractInstagramAccount(String snsUrl) { | ||
| if (snsUrl == null || snsUrl.isBlank()) { | ||
| return ""; | ||
| } | ||
| return snsUrl.replace("https://www.instagram.com/", "") | ||
| .replace("/", ""); | ||
| } |
There was a problem hiding this comment.
현재 extractInstagramAccount 메서드의 구현은 특정 케이스에서 올바르게 동작하지 않을 수 있습니다. 예를 들어, URL에 쿼리 파라미터가 포함된 경우(https://www.instagram.com/username/?hl=en) 아이디와 함께 쿼리 파라미터까지 반환하게 됩니다 (username?hl=en). 또한, 프로필 URL이 아닌 포스트 URL(https://www.instagram.com/p/some_id/)의 경우 psome_id와 같이 의도치 않은 결과를 반환할 수 있습니다.
정규식을 사용하여 더 견고하게 인스타그램 계정을 추출하는 것을 권장합니다. 이렇게 하면 다양한 URL 형식(http/https, www 유무, trailing slash, 쿼리 파라미터)을 처리하고 프로필 URL에서 사용자 이름만 정확하게 추출할 수 있습니다. 성능을 위해 Pattern 객체는 static final 상수로 선언하는 것이 가장 좋지만, 코드 제안의 한계로 메서드 내에서 생성하도록 제안합니다.
private static String extractInstagramAccount(String snsUrl) {
if (snsUrl == null || snsUrl.isBlank()) {
return "";
}
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("^https?://(?:www\\.)?instagram\\.com/([a-zA-Z0-9._]+)/?.*$");
java.util.regex.Matcher matcher = pattern.matcher(snsUrl);
if (matcher.matches()) {
return matcher.group(1);
}
return "";
}There was a problem hiding this comment.
현재 매칭검사 API 스펙 상 snsUrl은
https://www.instagram.com/{username} 형식으로만 저장되도록 보장되어 있습니다.
(쿼리 파라미터 및 포스트 URL은 입력 단계에서 허용하지 않습니다.)
Summary
마이프로필카드조회에서 sns를 아이디만 출력하게끔 수정
Changes
MyProfileCardResponseDto의 snsAccount필드
Type of Change
Related Issues
Fixes #318
참고 사항