{"record":{"id":"097a42c5b7341a69","repo":"RocketChat/Rocket.Chat","slug":"file-name-is-required","errorCode":null,"errorMessage":"File name is required","messagePattern":"File name is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/client/views/room/webdav/SaveToWebdavModal.tsx","lineNumber":77,"sourceCode":"\tuseEffect(() => fileRequest.current?.abort, []);\n\n\tconst handleSaveFile = ({ accountId }: { accountId: IWebdavAccount['_id'] }): void => {\n\t\tsetIsLoading(true);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tattachment: { title },\n\t\t} = data;\n\n\t\tfileRequest.current = new XMLHttpRequest();\n\t\tfileRequest.current.open('GET', url, true);\n\t\tfileRequest.current.responseType = 'arraybuffer';\n\t\tfileRequest.current.onload = async (): Promise<void> => {\n\t\t\tconst arrayBuffer = fileRequest.current?.response;\n\t\t\tif (arrayBuffer) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!title) {\n\t\t\t\t\t\tthrow new Error('File name is required');\n\t\t\t\t\t}\n\t\t\t\t\tconst response = await uploadFileToWebdav(accountId, arrayBuffer, title);\n\t\t\t\t\tif (!response.success) {\n\t\t\t\t\t\tthrow new Error(response.message ? t(response.message) : 'Error uploading file');\n\t\t\t\t\t}\n\t\t\t\t\treturn dispatchToastMessage({ type: 'success', message: t('File_uploaded') });\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn dispatchToastMessage({ type: 'error', message: error });\n\t\t\t\t} finally {\n\t\t\t\t\tsetIsLoading(false);\n\t\t\t\t\tonClose();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tfileRequest.current.send(null);\n\t};\n\n\treturn (","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/client/views/room/webdav/SaveToWebdavModal.tsx#L59-L95","documentation":"Client-side validation in the Save-to-WebDAV modal: after fetching the attachment bytes as an ArrayBuffer, the upload needs a file name, which is taken from the attachment's title field. If the attachment carries no title, the upload is aborted before uploadFileToWebdav is called and the toast shows this error.","triggerScenarios":"Choosing 'Save to WebDAV' on a message attachment whose title is empty or undefined: attachments synthesized by Apps Engine apps, incoming webhooks, or bridges that only set image/file URLs (title_link, image_url) without a title string.","commonSituations":"Bot/app-generated attachments without title, older messages or federation-bridged attachments dropping the title field, custom integrations posting attachments with only a URL.","solutions":["Ensure the attachment object includes a non-empty title (file name) — fix the app/webhook that posts the attachment","If you own the sending code, set attachment.title to the desired file name","As a code improvement, fall back to a name derived from the URL when title is missing"],"exampleFix":"// before\nif (!title) {\n\tthrow new Error('File name is required');\n}\nconst response = await uploadFileToWebdav(accountId, arrayBuffer, title);\n\n// after: derive a fallback name\nconst fileName = title || new URL(url).pathname.split('/').pop() || 'file';\nconst response = await uploadFileToWebdav(accountId, arrayBuffer, fileName);","handlingStrategy":"validation","validationCode":"if (!attachment?.title) {\n\t// do not even open the WebDAV flow without a file name\n\tdispatchToastMessage({ type: 'error', message: 'Attachment has no file name' });\n\treturn;\n}","typeGuard":"const hasFileName = (a?: { title?: string }): a is { title: string } =>\n\ttypeof a?.title === 'string' && a.title.length > 0;","tryCatchPattern":null,"preventionTips":["Require title on attachments produced by your apps/webhooks","Gate the 'Save to WebDAV' menu action on a non-empty attachment title","When building attachments programmatically, default title to the URL's basename"],"tags":["rocket-chat","webdav","attachments","file-upload","client-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}