mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: block PDF uploads, fix PBM/PGM/PPM batch failures, add tests
- Added isImageFile() filter to all drop handlers (dropzone, collage,
file-upload-area) so PDFs and non-image files are rejected on drop.
Previously only the file picker's accept attribute filtered; drag-and-
drop accepted anything.
- Added ppm, pgm, pbm to CLI_DECODED_FORMATS in file-validation.ts.
These formats were missing, causing Sharp metadata checks to fail for
some files during batch validation, which silently dropped them from
results ("File not found in batch results").
- Added integration tests for PBM, PGM, PPM, TIFF, QOI, JP2, SVGZ
single-file processing, plus a test confirming PDF is rejected.
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
X,
|
||||
} from "lucide-react";
|
||||
import { type DragEvent, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { isImageFile } from "@/components/common/dropzone";
|
||||
import { type CollageTemplate, getTemplateById } from "@/lib/collage-templates";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { CellTransform, CollageImage } from "@/stores/collage-store";
|
||||
@@ -95,7 +96,7 @@ function UploadArea() {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setIsDragging(false);
|
||||
const files = Array.from(e.dataTransfer.files);
|
||||
const files = Array.from(e.dataTransfer.files).filter(isImageFile);
|
||||
if (files.length > 0) addImages(files);
|
||||
},
|
||||
[addImages],
|
||||
|
||||
Reference in New Issue
Block a user