File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -653,24 +653,22 @@ function App() {
653653 const hasValidSourceParam = ! searchParamUrl && ! ! ( searchParams . get ( "uuid" ) || searchParams . get ( "file" ) ) ;
654654
655655 const urlHref = useMemo ( ( ) => {
656- if ( ! hasValidSourceParam ) {
657- let rawUrl ;
656+ if ( searchParamUrl ) {
658657 try {
659658 // 取url=之后的所有内容
660- rawUrl = location . search . match ( / \? u r l = ( [ ^ & ] + ) / ) ?. [ 1 ] || "" ;
661- if ( rawUrl ) {
662- const urlObject = new URL ( rawUrl ) ;
663- // 验证解析后的 URL 是否具备核心要素,确保安全性与合法性
664- if ( urlObject . protocol && urlObject . hostname && urlObject . pathname ) {
665- return rawUrl ;
666- }
659+ const idx = location . search . indexOf ( "url=" ) ;
660+ const rawUrl = idx !== - 1 ? location . search . slice ( idx + 4 ) : searchParamUrl ;
661+ const urlObject = new URL ( rawUrl ) ;
662+ // 验证解析后的 URL 是否具备核心要素,确保安全性与合法性
663+ if ( urlObject . protocol && urlObject . hostname && urlObject . pathname ) {
664+ return rawUrl ;
667665 }
668666 } catch {
669667 // ignored
670668 }
671669 }
672670 return "" ;
673- } , [ hasValidSourceParam ] ) ;
671+ } , [ searchParamUrl ] ) ;
674672
675673 const [ fetchingState , setFetchingState ] = useState ( {
676674 loadingStatus : "" ,
You can’t perform that action at this time.
0 commit comments