zulip-mobile
zulip-mobile copied to clipboard
file/image/video uploads: Use `max_file_upload_size_mib` server setting
- Store the value in Redux (get it from the
/registerresponse 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 .
- (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.
The 413 will come from nginx if the upload is larger than 80MB, or some other intermediate proxy if it has a lower limit.
The current app behavior (27.188) is to silently fail
We've had another request for this today: https://github.com/zulip/zulip-mobile/issues/5660#issuecomment-1440904936