zulip-mobile icon indicating copy to clipboard operation
zulip-mobile copied to clipboard

file/image/video uploads: Use `max_file_upload_size_mib` server setting

Open chrisbobbe opened this issue 4 years ago • 4 comments

  • Store the value in Redux (get it from the /register response and realm update events)
  • Read the file size of a file/image/video the user wants to upload
  • Prevent starting the upload if that size is bigger than the server setting
  • (If somehow the user manages to start the upload anyway, and the server gives an error that the file is too big, recognize the error and alert the user appropriately.)

For the "Read the file size" point, note https://github.com/react-native-image-picker/react-native-image-picker/pull/1883 .

chrisbobbe avatar Dec 03 '21 02:12 chrisbobbe

  • (If somehow the user manages to start the upload anyway, and the server gives an error that the file is too big, recognize the error and alert the user appropriately.)

We reportedly may get a response like this:

{"result":"error","msg":"Uploaded file is larger than the allowed limit of 25 MiB","code":"BAD_REQUEST"}

See also discussion: apparently POST /user_uploads can give a 413 Payload Too Large; it'd be good to recognize that. Tim says it probably comes from third-party code.

chrisbobbe avatar Apr 07 '22 19:04 chrisbobbe

The 413 will come from nginx if the upload is larger than 80MB, or some other intermediate proxy if it has a lower limit.

alexmv avatar Apr 07 '22 19:04 alexmv

The current app behavior (27.188) is to silently fail

maxxer avatar Jul 01 '22 10:07 maxxer

We've had another request for this today: https://github.com/zulip/zulip-mobile/issues/5660#issuecomment-1440904936

chrisbobbe avatar Feb 22 '23 23:02 chrisbobbe