Skip to content

fix(ocr): make file extension check case-insensitive - #394

Merged
R0Wi merged 3 commits into
R0Wi-DEV:masterfrom
chnateag:fix/case-insensitive-extension-check
Aug 25, 2026
Merged

fix(ocr): make file extension check case-insensitive#394
R0Wi merged 3 commits into
R0Wi-DEV:masterfrom
chnateag:fix/case-insensitive-extension-check

Conversation

@chnateag

Copy link
Copy Markdown
Contributor

Problem

When processing files with uppercase extensions (e.g., .PDF), the strict comparison $originalFileExtension !== self::PDF_FILE_EXTENSION evaluates to true. As a result, the application treats the PDF file as a non-PDF file and appends .pdf to the filename, creating unwanted duplicate files like filename.PDF.pdf.

Solution

Used strtolower() on $originalFileExtension in determineNewFilePath() (lib/Service/OcrService.php) to make the extension check case-insensitive.

Testing

Tested on a production Nextcloud instance processing files with .PDF extensions. The OCR process now overwrites the original file directly without creating .PDF.pdf duplicates.

@R0Wi

R0Wi commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Thanks @chnateag! Would you mind adding a unit test testcase for this?

@chnateag

Copy link
Copy Markdown
Contributor Author

Hi @R0Wi , hope it's done properly

@R0Wi

R0Wi commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Easy. Looks good thanks 🙏

Will try to get the CI running again. That's not your fault, I will take care of it and merge afterwards

@R0Wi
R0Wi self-requested a review August 25, 2026 04:12
@R0Wi
R0Wi merged commit 8bec2f7 into R0Wi-DEV:master Aug 25, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants