diff --git a/lib/__tests__/apk-parser.test.ts b/lib/__tests__/apk-parser.test.ts index ab0d4c5..c351ac0 100644 --- a/lib/__tests__/apk-parser.test.ts +++ b/lib/__tests__/apk-parser.test.ts @@ -8,9 +8,9 @@ describe('parseApkFilename', () => { expect(result.isValid).toBe(true); }); - it('should parse APK with version number segment (no environment suffix)', () => { + it('should parse APK without environment (product)', () => { const result = parseApkFilename('ft_0_42_ff9ff3441.apk'); - expect(result.environment).toBe('other'); + expect(result.environment).toBe('product'); expect(result.commit).toBe('ff9ff3441'); expect(result.isValid).toBe(true); }); @@ -46,8 +46,8 @@ describe('detectEnvironment', () => { expect(detectEnvironment('ft_sandbox_0_42_57ef3a60d.apk')).toBe('sandbox'); }); - it('should detect other for version number segment', () => { - expect(detectEnvironment('ft_0_42_ff9ff3441.apk')).toBe('other'); + it('should detect product environment (no suffix)', () => { + expect(detectEnvironment('ft_0_42_ff9ff3441.apk')).toBe('product'); }); it('should detect lan environment', () => { diff --git a/lib/apk-parser.ts b/lib/apk-parser.ts index f5561bb..fd6a712 100644 --- a/lib/apk-parser.ts +++ b/lib/apk-parser.ts @@ -16,8 +16,8 @@ const ENVIRONMENT_MAP: Record = { export function detectEnvironment(filename: string): ApkEnvironment { // Pattern: ft_[environment]_version_commit.apk - // Extract the environment segment between first and second underscores - const match = filename.match(/^ft_([^_]+)_/); + // Extract the environment segment (alphabetic only) between first and second underscores + const match = filename.match(/^ft_([a-z]+)_/i); if (!match) { // No environment suffix, default to product