Skip to content

[REFACTOR] 마이프로필카드조회 sns dto변경 (#318)#319

Merged
lingard1234 merged 2 commits intodevfrom
refactor/318-snsurl
Feb 8, 2026
Merged

[REFACTOR] 마이프로필카드조회 sns dto변경 (#318)#319
lingard1234 merged 2 commits intodevfrom
refactor/318-snsurl

Conversation

@lingard1234
Copy link
Copy Markdown
Contributor

Summary

마이프로필카드조회에서 sns를 아이디만 출력하게끔 수정

Changes

MyProfileCardResponseDto의 snsAccount필드

Type of Change

  • Bug fix (기존 기능에 영향을 주지 않는 버그 수정)
  • New feature (기존 기능에 영향을 주지 않는 새로운 기능 추가)
  • Breaking change (기존 기능에 영향을 주는 수정)
  • Refactoring (기능 변경 없는 코드 개선)
  • Documentation (문서 수정)
  • Chore (빌드, 설정 등 기타 변경)
  • Release (develop → main 배포)

Related Issues

Fixes #318

참고 사항

@lingard1234 lingard1234 self-assigned this Feb 8, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • SNS 계정 정보 처리 개선: MyProfileCardResponseDto에서 SNS URL 대신 Instagram 계정 ID만 추출하여 반환하도록 로직을 변경했습니다.
  • 새로운 유틸리티 메서드 추가: SNS URL에서 Instagram 계정 ID를 안전하게 추출하는 extractInstagramAccount 정적 메서드를 추가했습니다.
Changelog
  • src/main/java/com/example/RealMatch/user/presentation/dto/response/MyProfileCardResponseDto.java
    • from 메서드에서 snsUrl 필드를 처리하는 로직이 extractInstagramAccount 메서드를 사용하도록 수정되었습니다.
    • Instagram URL에서 계정 ID를 추출하는 private static String extractInstagramAccount(String snsUrl) 메서드가 추가되었습니다. 이 메서드는 URL에서 "https://www.instagram.com/" 및 "/"를 제거하여 순수한 계정 ID만 반환합니다.
Activity
  • 이 PR에는 현재까지 추가적인 활동(댓글, 리뷰 등)이 없습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

마이프로필카드 조회 시 SNS URL에서 계정 ID만 추출하도록 리팩터링한 부분을 검토했습니다. extractInstagramAccount 메서드를 추가하여 인스타그램 URL에서 계정명을 추출하는 로직을 구현하셨습니다. 현재 구현은 일부 엣지 케이스에서 의도치 않은 결과를 반환할 수 있어, 정규식을 사용하여 더 견고하게 계정명을 추출하는 방법을 제안드렸습니다. 이 부분은 기존 로직의 정확성을 높이는 중요한 개선 사항으로 판단되어 그대로 유지합니다.

Comment on lines +48 to +54
private static String extractInstagramAccount(String snsUrl) {
if (snsUrl == null || snsUrl.isBlank()) {
return "";
}
return snsUrl.replace("https://www.instagram.com/", "")
.replace("/", "");
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

현재 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 "";
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 매칭검사 API 스펙 상 snsUrl은
https://www.instagram.com/{username} 형식으로만 저장되도록 보장되어 있습니다.
(쿼리 파라미터 및 포스트 URL은 입력 단계에서 허용하지 않습니다.)

@lingard1234 lingard1234 merged commit 75ec343 into dev Feb 8, 2026
1 check passed
@lingard1234 lingard1234 deleted the refactor/318-snsurl branch February 8, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 마이페이지 인스타 id

1 participant