- Changed parseApkFilename to accept version parameter
- New parsing logic splits filename by version string to extract prefix
- detectEnvironment now takes prefix and configured tabs as arguments
- Environments not in APK_TABS are mapped to 'other' instead of hardcoded mapping
- Added getApkTabs helper function to expose configured tabs
- Updated all tests to use new API with version parameter
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split lib/utils.ts into:
- lib/utils.ts: Client-safe utilities only (no Node.js imports)
- lib/project-utils.ts: Server-only utilities with Node.js imports
This fixes the Next.js build error where client components were importing
modules that contained Node.js dependencies (fs, path).
All tests pass and build succeeds.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use letter-only regex pattern /ft_([a-z]+)_/i to correctly detect environment suffixes
- This ensures version numbers (starting with digits) are treated as no environment suffix
- Update test expectations to match spec behavior:
- ft_0_42_ff9ff3441.apk now correctly returns 'product' (no match)
- invalid_filename.apk returns 'product' (no match)
- All 10 tests pass with corrected implementation
- Add missing test case for lan environment detection
- Simplify detectEnvironment() to match spec exactly
- Remove extra logic (version number detection, ft_ prefix check)
- Update test expectations to match simplified implementation behavior
- All tests now pass with spec-compliant implementation
- Add detectEnvironment() to parse environment from APK filenames
- Add parseApkFilename() to extract environment and commit ID metadata
- Support dev, sandbox, product, and other environment types
- Map environment patterns: timeshift, lan, dev -> dev; sandbox -> sandbox
- Detect product APKs when no environment suffix present
- Handle invalid formats gracefully
- Move test files to lib/__tests__/ directory
- Extract formatting utilities (formatVersion, formatFileSize, formatDateTime)
from fs-utils.ts to new utils.ts module
- Add Jest test configuration and test scripts
- Update component imports to use new utils module
- Add CLAUDE.md documentation for project structure
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Replace fs.readFileSync() with fs.createReadStream() to prevent memory exhaustion
- Export validatePath() from fs-utils.ts
- Use validatePath() to validate full path including project and version parameters
- Fix incomplete path traversal protection
- Add filename encoding in Content-Disposition header
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fixed race condition in getProjects() by using Promise.all with proper async/await
- Fixed race condition in getVersions() by using Promise.all with proper async/await
- Fixed race condition in getApks() by ensuring Promise.all wraps the async map
- Added validatePath() helper function to prevent path traversal attacks
- Applied path validation to all file system operations
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>