공용 — getDirectFileUrl 로컬 origin 을 NEXT_PUBLIC_API_URL fallback 으로

localhost/127.0.0.1 일 때 하드코딩된 http://localhost:8080 대신
NEXT_PUBLIC_API_URL 의 origin(/api suffix 제거) 을 우선 사용.
환경변수 없을 때만 기존 http://localhost:8080 으로 떨어짐.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hjjeong
2026-05-14 16:09:05 +09:00
parent c955fe0dac
commit 3a5bcb5e3a
+2
View File
@@ -269,6 +269,8 @@ export const getDirectFileUrl = (filePath: string): string => {
// 로컬 개발환경
if (currentHost === "localhost" || currentHost === "127.0.0.1") {
const envOrigin = process.env.NEXT_PUBLIC_API_URL?.replace(/\/api$/, "");
if (envOrigin) return `${envOrigin}${filePath}`;
return `http://localhost:8080${filePath}`;
}
}