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',