Skip to content

feat: 프로필 이미지 업로드 로직 개선 및 기본 이미지 처리 추가#36

Merged
dasosann merged 1 commit intomainfrom
feat/profile-image
Mar 10, 2026
Merged

feat: 프로필 이미지 업로드 로직 개선 및 기본 이미지 처리 추가#36
dasosann merged 1 commit intomainfrom
feat/profile-image

Conversation

@dasosann
Copy link
Copy Markdown
Contributor

feat: 프로필 이미지 업로드 로직 개선 및 기본 이미지 처리 추가

@dasosann dasosann merged commit 36931b1 into main Mar 10, 2026
1 check passed
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

프로필 이미지 업로드 로직 개선 및 에러 처리 강화

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Presigned URL 요청에 파일명 파라미터 추가
• 이미지 업로드 단계별 에러 핸들링 강화
• 기본 이미지 처리 로직 단순화 및 명확화
• 불필요한 유틸 함수 제거 및 인라인 처리
Diagram
flowchart LR
  A["파일명 파라미터 추가"] --> B["Presigned URL 요청"]
  B --> C["에러 핸들링 추가"]
  C --> D["S3 업로드"]
  D --> E["기본 이미지 처리 단순화"]
  E --> F["프로필 제출"]
Loading

Grey Divider

File Changes

1. hooks/useProfileSignUp.ts ✨ Enhancement +32/-11

에러 핸들링 강화 및 파일명 파라미터 추가

• Presigned URL 요청 시 파일명을 쿼리 파라미터로 전달
• Presigned URL 발급과 S3 업로드 단계에 try-catch 에러 핸들링 추가
• 각 단계별 에러 로깅으로 디버깅 용이성 개선
• 함수 포맷팅 개선으로 가독성 향상

hooks/useProfileSignUp.ts


2. app/profile-image/_components/TermsDrawer.tsx ✨ Enhancement +3/-22

기본 이미지 처리 로직 단순화

• 기본 프로필 ID 목록 상수 제거
• 기본 이미지 변환 유틸 함수 제거
• 기본 이미지 처리를 컴포넌트 내 인라인으로 단순화
• 커스텀 이미지 없을 시 기본값 처리 로직 명확화

app/profile-image/_components/TermsDrawer.tsx


Grey Divider

Qodo Logo


✨ Describe tool usage guide:

Overview:
The describe tool scans the PR code changes, and generates a description for the PR - title, type, summary, walkthrough and labels. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

When commenting, to edit configurations related to the describe tool (pr_description section), use the following template:

/describe --pr_description.some_config1=... --pr_description.some_config2=...

With a configuration file, use the following template:

[pr_description]
some_config1=...
some_config2=...
Enabling\disabling automation
  • When you first install the app, the default mode for the describe tool is:
pr_commands = ["/describe", ...]

meaning the describe tool will run automatically on every PR.

  • Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:
pr_commands = ["/describe --pr_description.use_description_markers=true", ...]

the tool will replace every marker of the form pr_agent:marker_name in the PR description with the relevant content, where marker_name is one of the following:

  • type: the PR type.
  • summary: the PR summary.
  • walkthrough: the PR walkthrough.
  • diagram: the PR sequence diagram (if enabled).

Note that when markers are enabled, if the original PR description does not contain any markers, the tool will not alter the description at all.

Custom labels

The default labels of the describe tool are quite generic: [Bug fix, Tests, Enhancement, Documentation, Other].

If you specify custom labels in the repo's labels page or via configuration file, you can get tailored labels for your use cases.
Examples for custom labels:

  • Main topic:performance - pr_agent:The main topic of this PR is performance
  • New endpoint - pr_agent:A new endpoint was added in this PR
  • SQL query - pr_agent:A new SQL query was added in this PR
  • Dockerfile changes - pr_agent:The PR contains changes in the Dockerfile
  • ...

The list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.

Inline File Walkthrough 💎

For enhanced user experience, the describe tool can add file summaries directly to the "Files changed" tab in the PR page.
This will enable you to quickly understand the changes in each file, while reviewing the code changes (diffs).

To enable inline file summary, set pr_description.inline_file_summary in the configuration file, possible values are:

  • 'table': File changes walkthrough table will be displayed on the top of the "Files changed" tab, in addition to the "Conversation" tab.
  • true: A collapsable file comment with changes title and a changes summary for each file in the PR.
  • false (default): File changes walkthrough will be added only to the "Conversation" tab.
Utilizing extra instructions

The describe tool can be configured with extra instructions, to guide the model to a feedback tailored to the needs of your project.

Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is fixed, and cannot be changed. Extra instructions can change the content or style of each sub-section of the PR description.

Examples for extra instructions:

[pr_description]
extra_instructions="""- The PR title should be in the format: '<PR type>: <title>'
- The title should be short and concise (up to 10 words)
- ...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /help_docs <QUESTION>: Given a path to documentation (either for this repository or for a given one), ask a question.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the describe usage page for a comprehensive guide on using this tool.

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 10, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Serialized File upload crash 🐞 Bug ⛯ Reliability
Description
TermsDrawer가 profile.profileImageFile을 truthy 체크만으로 uploadImage에 전달하는데, ProfileProvider가 프로필 전체를
JSON.stringify로 localStorage에 저장/로드하므로 새로고침 후 profileImageFile이 실제 File이 아닌 plain object가 되어
file.name/file.type 접근이 깨져 presigned 발급 또는 S3 업로드가 런타임 실패합니다.
Code

hooks/useProfileSignUp.ts[R33-50]

+    const { data: response } = await api.get<PresignedUrlResponse>(
+      "/api/members/files/presigned/profiles",
+      { params: { filename: file.name } },
+    );
+    presignedUrl = response.data.presignedUrl;
+    imageKey = response.data.imageKey;
+  } catch (error) {
+    console.error("❌ Presigned URL을 받아오지 못했습니다.", error);
+    throw error;
+  }

-  // S3에 직접 업로드 (Axios 인스턴스 대신 표준 axios 사용 - baseURL 무시를 위해)
-  await axios.put(presignedUrl, file, {
-    headers: {
-      "Content-Type": file.type,
-    },
-  });
+  // 2단계: S3에 직접 업로드 (Axios 인스턴스 대신 표준 axios 사용 - baseURL 무시를 위해)
+  try {
+    await axios.put(presignedUrl, file, {
+      headers: {
+        "Content-Type": file.type,
+      },
+    });
Evidence
프로필 상태는 localStorage에 JSON으로 저장/복원되며, 화면에서 업로드한 File 객체도 그 상태에 그대로 저장됩니다. 이후 가입 완료 시점에
profileImageFile이 존재하면 uploadImage로 전달되는데, uploadImagefile.namefile.type을 사용하므로(이번
PR에서 filename 파라미터로 file.name 의존이 추가됨) 역직렬화된 비-File 값이면 즉시 실패합니다.

providers/profile-provider.tsx[22-28]
providers/profile-provider.tsx[36-46]
app/profile-image/_components/ScreenProfileImage.tsx[49-57]
app/profile-image/_components/TermsDrawer.tsx[100-105]
hooks/useProfileSignUp.ts[27-50]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`profileImageFile`(File 객체)가 ProfileProvider에서 localStorage에 JSON으로 저장/복원되면서 실제 `File` 형태가 보존되지 않습니다. 이후 `TermsDrawer.handleComplete()`에서 truthy 체크만으로 `uploadImage()`에 전달되고, 이번 PR에서 `uploadImage()`가 `file.name`을 쿼리 파라미터로 사용하게 되어 새로고침/재방문 시 런타임 실패가 발생할 수 있습니다.

### Issue Context
- 프로필 상태는 localStorage에 그대로 저장됩니다.
- File 객체는 JSON 직렬화/역직렬화로 원형이 보존되지 않습니다.
- `uploadImage()`는 `file.name`/`file.type`에 의존합니다.

### Fix Focus Areas
- providers/profile-provider.tsx[22-46]
- app/profile-image/_components/ScreenProfileImage.tsx[49-57]
- app/profile-image/_components/TermsDrawer.tsx[94-105]
- hooks/useProfileSignUp.ts[27-50]

### Expected changes
1) localStorage에 저장할 프로필 데이터에서 `profileImageFile`을 제외(저장 직전 삭제)하거나, 로드 직후 `profileImageFile`을 항상 `undefined`로 정리.
2) `TermsDrawer`에서 업로드 호출 전에 `profile.profileImageFile instanceof File` 체크. 아니라면 `updateProfile({ profileImageFile: undefined })`(provider 접근 가능 시)로 정리하고 에러 메시지/재선택 유도.
3) 가능하면 `useProfile` 상태를 `persisted fields`와 `ephemeral fields(File/preview)`로 분리.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +33 to +50
const { data: response } = await api.get<PresignedUrlResponse>(
"/api/members/files/presigned/profiles",
{ params: { filename: file.name } },
);
presignedUrl = response.data.presignedUrl;
imageKey = response.data.imageKey;
} catch (error) {
console.error("❌ Presigned URL을 받아오지 못했습니다.", error);
throw error;
}

// S3에 직접 업로드 (Axios 인스턴스 대신 표준 axios 사용 - baseURL 무시를 위해)
await axios.put(presignedUrl, file, {
headers: {
"Content-Type": file.type,
},
});
// 2단계: S3에 직접 업로드 (Axios 인스턴스 대신 표준 axios 사용 - baseURL 무시를 위해)
try {
await axios.put(presignedUrl, file, {
headers: {
"Content-Type": file.type,
},
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Serialized file upload crash 🐞 Bug ⛯ Reliability

TermsDrawer가 profile.profileImageFile을 truthy 체크만으로 uploadImage에 전달하는데, ProfileProvider가 프로필 전체를
JSON.stringify로 localStorage에 저장/로드하므로 새로고침 후 profileImageFile이 실제 File이 아닌 plain object가 되어
file.name/file.type 접근이 깨져 presigned 발급 또는 S3 업로드가 런타임 실패합니다.
Agent Prompt
### Issue description
`profileImageFile`(File 객체)가 ProfileProvider에서 localStorage에 JSON으로 저장/복원되면서 실제 `File` 형태가 보존되지 않습니다. 이후 `TermsDrawer.handleComplete()`에서 truthy 체크만으로 `uploadImage()`에 전달되고, 이번 PR에서 `uploadImage()`가 `file.name`을 쿼리 파라미터로 사용하게 되어 새로고침/재방문 시 런타임 실패가 발생할 수 있습니다.

### Issue Context
- 프로필 상태는 localStorage에 그대로 저장됩니다.
- File 객체는 JSON 직렬화/역직렬화로 원형이 보존되지 않습니다.
- `uploadImage()`는 `file.name`/`file.type`에 의존합니다.

### Fix Focus Areas
- providers/profile-provider.tsx[22-46]
- app/profile-image/_components/ScreenProfileImage.tsx[49-57]
- app/profile-image/_components/TermsDrawer.tsx[94-105]
- hooks/useProfileSignUp.ts[27-50]

### Expected changes
1) localStorage에 저장할 프로필 데이터에서 `profileImageFile`을 제외(저장 직전 삭제)하거나, 로드 직후 `profileImageFile`을 항상 `undefined`로 정리.
2) `TermsDrawer`에서 업로드 호출 전에 `profile.profileImageFile instanceof File` 체크. 아니라면 `updateProfile({ profileImageFile: undefined })`(provider 접근 가능 시)로 정리하고 에러 메시지/재선택 유도.
3) 가능하면 `useProfile` 상태를 `persisted fields`와 `ephemeral fields(File/preview)`로 분리.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

1 participant