fix(ocr): TIFF overlapping with image processor

This commit is contained in:
Elian Doran
2026-04-02 20:26:31 +03:00
parent aafecaa3a4
commit 8ac686a19f
3 changed files with 4 additions and 7 deletions

View File

@@ -41,10 +41,10 @@ class OCRService {
private processors: Map<string, FileProcessor> = new Map();
constructor() {
// Initialize file processors
this.processors.set('image', new ImageProcessor());
const imageProcessor = new ImageProcessor();
this.processors.set('image', imageProcessor);
this.processors.set('pdf', new PDFProcessor());
this.processors.set('tiff', new TIFFProcessor());
this.processors.set('tiff', new TIFFProcessor(imageProcessor));
this.processors.set('office', new OfficeProcessor());
}

View File

@@ -19,7 +19,6 @@ export class ImageProcessor extends FileProcessor {
'image/png',
'image/gif',
'image/bmp',
'image/tiff',
'image/webp'
];

View File

@@ -9,12 +9,10 @@ import { ImageProcessor } from './image_processor.js';
* TIFF processor for extracting text from multi-page TIFF files
*/
export class TIFFProcessor extends FileProcessor {
private imageProcessor: ImageProcessor;
private readonly supportedTypes = ['image/tiff', 'image/tif'];
constructor() {
constructor(private imageProcessor: ImageProcessor) {
super();
this.imageProcessor = new ImageProcessor();
}
canProcess(mimeType: string): boolean {