From 08551a0482b2dc5cefa279f6fa91dd717256d1a2 Mon Sep 17 00:00:00 2001 From: dasosann Date: Fri, 29 May 2026 13:55:11 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=ED=9E=88=EC=8A=A4=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=82=B4=EC=97=AD=EC=9D=84=20=ED=86=B5=ED=95=9C=20?= =?UTF-8?q?=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EB=B6=84=EA=B8=B0=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../album/4cut/components/ScreenAlbum4Cut.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx b/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx index d42762e7..c0a6c34d 100644 --- a/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx +++ b/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx @@ -20,6 +20,7 @@ import { useQueryClient } from '@tanstack/react-query'; import { Download, Loader2, LucideIcon, Menu, Send } from 'lucide-react'; import dynamic from 'next/dynamic'; import Link from 'next/link'; +import { useRouter } from 'next/navigation'; import { useEffect, useRef, useState } from 'react'; import { useGetAlbumInfo } from '../../detail/hooks/useGetAlbumInfo'; import { use4CutAiSummary } from '../hooks/use4CutAiSummary'; @@ -37,11 +38,22 @@ interface ScreenAlbum4CutProps { } export default function ScreenAlbum4Cut({ albumId }: ScreenAlbum4CutProps) { + const router = useRouter(); const queryClient = useQueryClient(); const [isCaptureVisible, setIsCaptureVisible] = useState(false); const [isDownloading, setIsDownloading] = useState(false); const [showExplanation, setShowExplanation] = useState(false); const captureRef = useRef(null); + + const handleBackClick = () => { + if (typeof window === 'undefined') return; + const isNewTab = window.history.length <= 1 || !document.referrer; + if (isNewTab) { + router.push('/main'); + } else { + router.back(); + } + }; const { data } = useGetAlbumInfo(albumId); const { data: albumInformData } = useGetAlbumInform({ code: albumId }); const { data: { name } = {} } = useGetUserMe(); @@ -201,6 +213,7 @@ export default function ScreenAlbum4Cut({ albumId }: ScreenAlbum4CutProps) { <> From 0777045b6fa0bbf1b80c12b7c476d529224abfce Mon Sep 17 00:00:00 2001 From: dasosann Date: Fri, 29 May 2026 14:00:37 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../album/4cut/components/ScreenAlbum4Cut.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx b/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx index c0a6c34d..a83179cf 100644 --- a/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx +++ b/src/feature/album/4cut/components/ScreenAlbum4Cut.tsx @@ -47,8 +47,20 @@ export default function ScreenAlbum4Cut({ albumId }: ScreenAlbum4CutProps) { const handleBackClick = () => { if (typeof window === 'undefined') return; + // 공유 링크 등 외부 유입 시 외부 사이트로 되돌아가는 것을 방지합니다. const isNewTab = window.history.length <= 1 || !document.referrer; - if (isNewTab) { + // referrer가 우리 서비스 origin일 때만 안전한 내부 이동으로 봅니다. + const isInternalReferrer = (() => { + if (!document.referrer) return false; + try { + return new URL(document.referrer).origin === window.location.origin; + } catch { + return false; + } + })(); + + if (isNewTab || !isInternalReferrer) { + // 히스토리/리퍼러가 신뢰되지 않으면 안전한 내부 경로로 보냅니다. router.push('/main'); } else { router.back();