From 7d2f92b564a887c1c0027ede7af87d0fb11e7f95 Mon Sep 17 00:00:00 2001 From: Zain Date: Sat, 15 Aug 2026 09:03:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(platform-detector):=20=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E5=A4=A9=E7=BF=BC=E4=BA=91=E7=9B=98=E9=A6=96=E9=A1=B5=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=AF=86=E5=88=AB=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当访问天翼云盘首页(`/web/main/`)时,返回 `esurfing` 平台标识 --- src/utils/platform-detector.ts | 2 +- tests/unit/platform-detection.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/platform-detector.ts b/src/utils/platform-detector.ts index b3dce10..479789f 100644 --- a/src/utils/platform-detector.ts +++ b/src/utils/platform-detector.ts @@ -115,7 +115,7 @@ export function detectPlatformFromUrl(url: string, pathname?: string): PlatformN // 天翼云盘 if (url.includes('cloud.189.cn')) { const pathToCheck = pathname ?? extractPathnameFromUrl(url); - return pathToCheck.startsWith('/web/main/file') ? 'esurfing' : null; + return pathToCheck === '/web/main' || pathToCheck === '/web/main/' || pathToCheck.startsWith('/web/main/file') ? 'esurfing' : null; } // UC网盘 diff --git a/tests/unit/platform-detection.test.ts b/tests/unit/platform-detection.test.ts index 598eeca..34f77af 100644 --- a/tests/unit/platform-detection.test.ts +++ b/tests/unit/platform-detection.test.ts @@ -242,6 +242,14 @@ describe('Platform Detection - Unified Utils', () => { expect(result).toBe('cmcc'); }); + it('should detect Esurfing Drive entry page before navigating into file lists', () => { + const result = detectPlatformFromUrl( + 'https://cloud.189.cn/web/main/', + '/web/main/' + ); + expect(result).toBe('esurfing'); + }); + it('should detect Esurfing Drive', () => { const result = detectPlatformFromUrl( 'https://cloud.189.cn/web/main/file/folder/folder189',