mirror of
https://github.com/makeplane/plane.git
synced 2026-06-13 19:19:54 +00:00
fix: reject suspicious filenames and match file icons case-insensitively
- Short-circuit validateAndDetectFileType when validateFilename flags a suspicious name so files like foo.exe.md cannot bypass the attachment allowlist via the new extension MIME fallback. - Lowercase fileType in getFileIcon so uppercase extensions (e.g. .MD, .PDF) resolve to the correct icon.
This commit is contained in:
@@ -25,7 +25,7 @@ import {
|
||||
} from "@/components/icons/attachment";
|
||||
|
||||
export const getFileIcon = (fileType: string, size: number = 28) => {
|
||||
switch (fileType) {
|
||||
switch (fileType.toLowerCase()) {
|
||||
case "pdf":
|
||||
return <PdfIcon height={size} width={size} />;
|
||||
case "csv":
|
||||
|
||||
@@ -114,6 +114,7 @@ const validateAndDetectFileType = async (file: File): Promise<string> => {
|
||||
const filenameError = validateFilename(file.name);
|
||||
if (filenameError) {
|
||||
console.warn(`File validation warning: ${filenameError}`);
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user