{"record":{"id":"318b3eeaea8fc5b1","repo":"discourse/discourse","slug":"file-with-a-0-byte-size-detected-cancelling-uploa","errorCode":null,"errorMessage":"File with a 0 byte size detected, cancelling upload.","messagePattern":"File with a 0 byte size detected, cancelling upload\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/discourse/app/lib/uploads.js","lineNumber":135,"sourceCode":"        })\n      );\n      return false;\n    }\n  }\n\n  if (!opts.bypassNewUserRestriction) {\n    // ensures that new users can upload a file\n    if (user && !user.isAllowedToUploadAFile(opts.type)) {\n      dialog.alert(\n        i18n(`post.errors.${opts.type}_upload_not_allowed_for_new_user`)\n      );\n      return false;\n    }\n  }\n\n  if (file.size === 0) {\n    /* eslint-disable no-console */\n    console.warn(\"File with a 0 byte size detected, cancelling upload.\", file);\n    dialog.alert(i18n(\"post.errors.file_size_zero\"));\n    return false;\n  }\n\n  // everything went fine\n  return true;\n}\n\nfunction extensionsToArray(exts) {\n  return exts\n    .toLowerCase()\n    .replace(/[\\s\\.]+/g, \"\")\n    .split(\"|\")\n    .filter((ext) => !ext.includes(\"*\"));\n}\n\nfunction extensions(siteSettings) {\n  return extensionsToArray(siteSettings.authorized_extensions);","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/discourse/discourse/blob/1b2d7253e854205d2c95c80b2c6a1cdd42e45059/frontend/discourse/app/lib/uploads.js#L117-L153","documentation":"Error \"File with a 0 byte size detected, cancelling upload.\" thrown in discourse/discourse.","triggerScenarios":"Thrown at frontend/discourse/app/lib/uploads.js:135 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b2d7253e854205d2c95c80b2c6a1cdd42e45059","analyzedAt":"2026-08-26T03:11:08.302Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}