{"record":{"id":"e25a4918d08e6d46","repo":"AykutSarac/jsoncrack.com","slug":"invalid-file","errorCode":null,"errorMessage":"Invalid file","messagePattern":"Invalid file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/www/src/features/editor/FullscreenDropzone.tsx","lineNumber":49,"sourceCode":"        ta=\"center\"\n        align=\"center\"\n        gap=\"xl\"\n        h=\"100vh\"\n        style={{ pointerEvents: \"none\" }}\n      >\n        <Dropzone.Accept>\n          <VscFiles size={100} />\n          <Text fz=\"h1\" fw={500} mt=\"lg\">\n            Upload to JSON Crack\n          </Text>\n          <Text fz=\"lg\" c=\"dimmed\" mt=\"sm\">\n            (Max file size: 300 KB)\n          </Text>\n        </Dropzone.Accept>\n        <Dropzone.Reject>\n          <VscCircleSlash size={100} />\n          <Text fz=\"h1\" fw={500} mt=\"lg\">\n            Invalid file\n          </Text>\n          <Text fz=\"lg\" c=\"dimmed\" mt=\"sm\">\n            Allowed formats are JSON, YAML, CSV, XML\n          </Text>\n        </Dropzone.Reject>\n      </Group>\n    </Dropzone.FullScreen>\n  );\n};\n","sourceCodeStart":31,"sourceCodeEnd":59,"githubUrl":"https://github.com/AykutSarac/jsoncrack.com/blob/3c9af69e23c635356293b6b28cf4cd0af10d1059/apps/www/src/features/editor/FullscreenDropzone.tsx#L31-L59","documentation":"Dropzone.Reject renders 'Invalid file' when a dropped file's MIME type is not in the accept list (application/json, application/x-yaml, text/csv, application/xml). Mantine's Dropzone matches against the OS-reported MIME type, so mis-detected types also land here even when the extension is correct.","triggerScenarios":"Dropping a .json5, .jsonc, .toml, .txt or .log file; the OS reporting a generic application/octet-stream for a .json file transferred from an archive; dropping an image or PDF; a YAML file identified as text/plain instead of application/x-yaml.","commonSituations":"Windows reporting no/incorrect MIME for .json; CSV detected as text/plain; user expects extension-based acceptance but the gate is MIME-only.","solutions":["Add text/plain and common subtypes to accept if a permissive policy is desired.","Rename the file with the correct extension before dropping.","Rely on the onDrop extension-based fallback already present in the code.","If MIME is unreliable on the target OS, switch Mantine accept to extension matching."],"exampleFix":"// before\naccept={[\"application/json\", \"application/x-yaml\", \"text/csv\", \"application/xml\"]}\n\n// after\naccept={[\"application/json\", \"application/x-yaml\", \"text/csv\", \"text/plain\", \"application/xml\"]}","handlingStrategy":"validation","validationCode":"const ACCEPTED = [\"application/json\", \"application/x-yaml\", \"text/csv\", \"application/xml\", \"text/plain\"];\nfunction isAcceptedMime(file: { type: string }): boolean {\n  return ACCEPTED.includes(file.type);\n}","typeGuard":"function isAcceptedFile(file: File): boolean {\n  const acceptedExt = [\"json\", \"yaml\", \"yml\", \"csv\", \"xml\"];\n  const ext = file.name.split(\".\").pop()?.toLowerCase() ?? \"\";\n  return isAcceptedMime(file) || acceptedExt.includes(ext);\n}","tryCatchPattern":null,"preventionTips":["Add text/plain to the accept list because Windows sometimes reports no MIME for .json/.csv.","Fall back to extension-based acceptance when the OS reports a generic application/octet-stream.","Keep the 'Allowed formats' helper text in sync with the accept prop."],"tags":["dropzone","mime-type","file-upload","ui-text"],"backgroundTag":null,"analyzedSha":"3c9af69e23c635356293b6b28cf4cd0af10d1059","analyzedAt":"2026-08-12T19:00:27.891Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}