-
Notifications
You must be signed in to change notification settings - Fork 51.8k
Description
Bug Description
When you upload a file to OneDrive the filename from the settings is ignored, and the filename from the binary file itself is used.
I can't currently make a PR for this, but the error is here:
n8n/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts
Lines 209 to 226 in f3fa3f9
| if (operation === 'upload') { | |
| const parentId = this.getNodeParameter('parentId', i) as string; | |
| const isBinaryData = this.getNodeParameter('binaryData', i); | |
| const fileName = this.getNodeParameter('fileName', i) as string; | |
| if (isBinaryData) { | |
| const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0); | |
| const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName); | |
| const body = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); | |
| let encodedFilename; | |
| if (fileName !== '') { | |
| encodedFilename = encodeURIComponent(fileName); | |
| } | |
| if (binaryData.fileName !== undefined) { | |
| encodedFilename = encodeURIComponent(binaryData.fileName); | |
| } |
the encodedFilename var is set from the settings, but then gets overridden if there is a filename in the binary file. I would suggest switching the order of these two if statements. Check for filename in the binary file first , and overwrite if there is a filename set in the settings.
To Reproduce
- have a binary file
- Upload to Microsoft Onedrive
- Set filename in settings, and select 'binary file'
- Execute step
- Filename on Onedrive has binary file filename, not the settings one
Expected behavior
Expected the filename from the settings to be used when filled out
Debug Info
Not needed. Not an error, just a wrong filename
Operating System
Docker
n8n Version
1.122.4
Node.js Version
unknown
Database
SQLite (default)
Execution mode
main (default)
Hosting
self hosted