richfromm / slack2discord

A Discord client that imports Slack-exported JSON chat history to Discord channel(s).
GNU General Public License v3.0
8 stars 3 forks source link

Deal with discord file size limit #40

Open richfromm opened 1 year ago

richfromm commented 1 year ago

According to various sources online (many complaining about this), the max file size on a free plan is 8 MB. (I have not yet tried to verify this.) For paid plans, the currently posted limits at https://discord.com/nitro are either 50 MB or 500 MB. Online sources were inconsistent, some saying 50 MB, some saying 100 MB. But the bottom line is that there is no one single fixed limit, and it could be subject to change.

Unlike the case of the message text character limit (https://github.com/richfromm/slack2discord/issues/29), I don't think we just want to err on the side of the lower fixed limit for free accounts. In that case, the consequences are minimal, we just might split messages that didn't really need it (or split messages more than necessary). But in this case, there's no good fallback, we just can't upload the file if we're over the limit. So we don't want to have a false positive.

Which means that rather than try to anticipate this in advance, we should instead detect and then handle the error. I will have to do some testing to see precisely how this manifests itself at the HTTP level. (I fear that right now we'll just end up in an endless retry loop, see https://github.com/richfromm/slack2discord/issues/25)

If we can't upload a file, we should log an error and then continue. I'll have to think about whether that's all we do. See the long discussion at https://github.com/richfromm/slack2discord/pull/20#discussion_r1019512583, where I was debating whether for the case of a file deleted from slack if we should upload some placeholder to discord indicating a file that ought to be there but is missing. There is potentially a stronger case for doing this here, since we know various info about the file (its name, possibly its type, its size). Still, I'm not sure if the minimal added value of an empty placeholder is actually worth the trouble.