fix: clips not found with no extensions#311
Conversation
WalkthroughThe PR extends ChangesFile Resolution Matching
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
shared/packages/api/src/filePath.ts (1)
38-60: ⚡ Quick winUpdate JSDoc to document exact-match behavior and empty extension cases.
The JSDoc examples don't cover the new exact-match behavior introduced by the
|| f === basecondition. Consider adding examples showing:
- When an extensionless file exists (e.g., searching for
/path/to/filefindsfile→ returnsextension: '')- When the input path already includes an extension (e.g., searching for
/path/to/file.mp4findsfile.mp4→ returnsextension: '')- When both extensionless and extension files exist (returns
multiple)This will help users understand when the
extensionfield will be an empty string versus containing an actual extension.📝 Suggested JSDoc additions
* `@example` * // If looking for /path/to/file and file.tar.gz exists: * const result = await resolveFileWithoutExtension('/path/to/file') * // Returns: { result: 'found', fullPath: '/path/to/file.tar.gz', extension: '.tar.gz' } * + * `@example` + * // If looking for /path/to/file and an extensionless file exists: + * const result = await resolveFileWithoutExtension('/path/to/file') + * // Returns: { result: 'found', fullPath: '/path/to/file', extension: '' } + * + * `@example` + * // If the input path already includes the extension: + * const result = await resolveFileWithoutExtension('/path/to/file.mp4') + * // Returns: { result: 'found', fullPath: '/path/to/file.mp4', extension: '' } + * * `@example` * // If both file.mp4 and file.mov exist: * const result = await resolveFileWithoutExtension('/path/to/file') * // Returns: { result: 'multiple', matches: ['/path/to/file.mp4', '/path/to/file.mov'] }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@shared/packages/api/src/filePath.ts` around lines 38 - 60, Update the JSDoc for resolveFileWithoutExtension to document the exact-match and empty-extension behavior: add an example showing when an extensionless file exists (searching '/path/to/file' finds 'file' and returns extension: ''), an example showing when the input already includes an extension (searching '/path/to/file.mp4' finds 'file.mp4' and returns extension: ''), and an example showing when both extensionless and extensioned files exist (returns result: 'multiple' with matches). Mention that the code treats exact filename matches (f === base) as extensionless and clarify when extension is an empty string vs a dot-prefixed extension.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@shared/packages/api/src/filePath.ts`:
- Around line 38-60: Update the JSDoc for resolveFileWithoutExtension to
document the exact-match and empty-extension behavior: add an example showing
when an extensionless file exists (searching '/path/to/file' finds 'file' and
returns extension: ''), an example showing when the input already includes an
extension (searching '/path/to/file.mp4' finds 'file.mp4' and returns extension:
''), and an example showing when both extensionless and extensioned files exist
(returns result: 'multiple' with matches). Mention that the code treats exact
filename matches (f === base) as extensionless and clarify when extension is an
empty string vs a dot-prefixed extension.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c0ae49cf-604e-484b-8ee6-0514444160f3
📒 Files selected for processing (2)
shared/packages/api/src/__tests__/filePath.spec.tsshared/packages/api/src/filePath.ts
|



About Me
This pull request is posted on behalf of the BBC.
Type of Contribution
This is a: Bug fix
Current Behavior
When
MATCH_FILENAMES_WITHOUT_EXTENSION=1is used full path matches are ignored.unset
MATCH_FILENAMES_WITHOUT_EXTENSIONfi.le.mp4findsfi.le.mp4fi.ledoesn't findfi.le.mp4fi.lefindsfi.leMATCH_FILENAMES_WITHOUT_EXTENSION=1fi.le.mp4doesn't findfi.le.mp4fi.lefindsfi.le.mp4fi.ledoesn't findfi.leNew Behavior
Full paths now resolve to the correct files.
When
MATCH_FILENAMES_WITHOUT_EXTENSION=1is used full path matches are ignored.unset
MATCH_FILENAMES_WITHOUT_EXTENSIONfi.le.mp4findsfi.le.mp4fi.ledoesn't findfi.le.mp4fi.lefindsfi.leMATCH_FILENAMES_WITHOUT_EXTENSION=1fi.le.mp4findsfi.le.mp4fi.lefindsfi.le.mp4fi.lefindsfi.leTesting Instructions
Test the cases listed above my changing the expected path in NRCS and renaming the files in the directory observed by package manager.
Status