Onedrive for business weird filename issue when uploading a file

Describe the problem/error/question

Hi, first thanks for reading my issue :).
I’ve got something weird when I try to upload a file to OneDrive (business), I’ve got a developers tenant where I do my experiments.
I’m running the default docker image:
Behind an apache reverse proxy.

When uploading a file to a specified directory (n8n) in the root of the drive, I expect to get
for example /n8n/filename.txt. But instead I’m getting the content type written out in a directory/filename. For example I’m trying to upload “n8n test file.txt” so I expect to find “/n8n/n8n test file.txt”. But instead I get: “/n8n/text/plain” as seen below in the screenshot.


Addition, off course I forget to attach my post to the webhook :).


(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Not sure if this is needed, since there is a lot information about my tenant.

Information on your n8n setup

  • n8n version: 0.224.4
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: default docker

Hi @GKdeVries, welcome to the community and sorry for the trouble!

I was able to reproduce this problem, the filename set in the node appears to be ignored for uploads to OneDrive business. There seem to be additional problems with the way n8n handles plain/text files for incoming webhooks as well and I shall add this to our bug tracker for a fix.

I’ll fiddle around with this some more and see if I can come up with a workaround in the meantime.

Okay, so file handling seems to work fine for files other than plain/text files. Were you just using this text file for testing and will be sending other file types to n8n going forward?

If so and seeing you are providing the filename in a query parameter filename, you can get this to work by simply renaming your file before sending it to the OneDrive node. Like so:

1 Like

Thanks for looking into this @MutedJam,

But looking into this with fresh eyes, I would say it is already going wrong at the first step (webhook).
Since it`s putting the using the content-type as an filename instead of the original filename as shown in the screenshot below. This will indeed create the weird path, since the filename is a path :).

Off course we can remedy this with your example with the addition of a code node (nicely done :)) or my first work-around for this as shown below.
But I would say the webhook is at fault since the given filename is incorrect since it`s using the content-type as the filename.

That`s indeed weird the result of the textfile in onedrive is empty. I’ve also tried a couple of other files (jpg, xml, json, xls) but these look fine.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.