Dragory / modmailbot

Modmail Bot is a bot for Discord that makes it easier for users to contact moderators and admins for help.
MIT License
699 stars 701 forks source link

EXDEV error when attachmentStorage is set to local #276

Closed Gigabitzz closed 5 years ago

Gigabitzz commented 5 years ago

Hey there,

I am not sure if this particular query is related to node.js or Linux in general. I appear to be having an issue where the bot crashes when a message includes an attachment:

  errno: -18,
  code: 'EXDEV',
  syscall: 'rename',
  path: '/tmp/tmp-23215ceiMrCssHqG0.tmp',
  dest:
   '/home/discord/modmail/src/data/../../attachments/573386030309179402' }
Error: EXDEV: cross-device link not permitted, rename '/tmp/tmp-23215ceiMrCssHqG0.tmp' -> '/home/discord/modmail/src/data/../../attachments/573386030309179402'

I found out that that the code related to tmp is found in /src/data/attachments.js. However, I am not sure if it would be wise to alter the code to meet the solutions I found on Google. The reason why I say this is because the error does not appear at all on my second Linux system, so I am certain this has something to do with my system.

While changing attachmentStorage to discord rectifies this issue, I prefer attachments being stored locally.

Any solution would be appreciated. Thank you!

Dragory commented 5 years ago

Hmm, seems to be an issue when the tmp folder is on a different drive than the bot itself. I'll look into pushing a fix for this soon!

Dragory commented 5 years ago

This should be fixed in v2.28.0.