Skip to content

[FE] URL 파싱 로직을 개선하세요. #175

@junglesub

Description

@junglesub

🛠️ Refactor suggestion

URL 파싱 로직을 개선하세요.

presigned URL에서 실제 URL을 추출하는 로직이 안전하지 않습니다.

다음과 같이 개선하는 것을 권장합니다:

-     const url = res.url || res.presignedUrl?.split("?")[0] || "";
+     const url = res.url || (res.presignedUrl ? new URL(res.presignedUrl).origin + new URL(res.presignedUrl).pathname : "");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      const url = res.url || (res.presignedUrl
        ? new URL(res.presignedUrl).origin + new URL(res.presignedUrl).pathname
        : "");
      if (onUploaded) onUploaded(url);
🤖 Prompt for AI Agents
In src/main/front/src/components/UserProfileImageUploadBox.tsx around lines 70
to 71, the current logic for extracting the URL from presignedUrl by splitting
on "?" is unsafe. Improve this by using a proper URL parsing method to extract
the base URL without query parameters, ensuring it handles edge cases correctly.
Replace the split approach with a more robust URL parsing technique before
passing the URL to onUploaded.

Originally posted by @coderabbitai[bot] in #172 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions