SwiftcordApp / Swiftcord

A fully native Discord client for macOS built 100% in Swift!

Home Page:https://swiftcordapp.github.io/Swiftcord/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Uploads above 8MB not accepted

BomberFish opened this issue · comments

commented

Describe the Bug

Bug Description

Any file above 8 megabytes is not accepted. Recently, Discord changed the free file upload limit to 25 megabytes, and level 2 and 3 boosted servers increase the limit for all users to 50 and 100 megabytes respectively.

Actual Behaviour

The upload fails.
Screenshot taken on 2023-05-14 at 18 55 59

Expected Behavior

The upload should succeed.

Reproducing the Bug

  1. Upload file bigger than 8MB and less than 25MB on a nitroless account
  2. See it get denied :(

Version

0.6.1

Category

Media (images, audio, video etc.)

Relevant Log Output

No response

Screenshots

No response

Additional Info

No response

Ah this is due to the file size limit being hardcoded in the upload check. It would simply require a single change here:

guard let size = try? attachment.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).fileSize, size < 8*1024*1024 else {

Something along the lines of

- guard let size = try? attachment.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).fileSize, size < 8*1024*1024 else { 
+ guard let size = try? attachment.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).fileSize, size < 25*1024*1024 else {