Skip to content

Commit

Permalink
Check if file is empty before upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Dec 21, 2015
1 parent 8642dde commit f4da73e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"Favorites" : "Favorites",
"FileUpload" : "File Upload",
"FileUpload_Enabled" : "File Uploads Enabled",
"FileUpload_File_Empty" : "File empty",
"FileUpload_MaxFileSize" : "Maximum File Upload Size (in bytes)",
"FileUpload_MediaType_NotAccepted" : "Media Types Not Accepted",
"FileUpload_MediaTypeWhiteList" : "Accepted Media Types",
Expand Down Expand Up @@ -296,7 +297,6 @@
"Msgs" : "Msgs",
"multi" : "multi",
"Mute_user" : "Mute user",
"Unmute_user" : "Unmute user",
"My_Account" : "My Account",
"n_messages" : "%s messages",
"Name" : "Name",
Expand Down Expand Up @@ -475,6 +475,7 @@
"There_is_no_integrations" : "There is no integrations",
"This_is_a_push_test_messsage" : "This is a push test messsage",
"True" : "True",
"Unmute_user" : "Unmute user",
"Unnamed" : "Unnamed",
"Unread_Rooms" : "Unread Rooms",
"Unread_Rooms_Mode" : "Unread Rooms Mode",
Expand Down Expand Up @@ -503,15 +504,15 @@
"User_left_female" : "Has left the channel.",
"User_left_male" : "Has left the channel.",
"User_logged_out" : "User is logged out",
"User_muted_by" : "User <em>__user_muted__</em> muted by <em>__user_by__</em>.",
"User_muted_in_room" : "User muted in room",
"User_unmuted_in_room" : "User unmuted in room",
"User_not_found_or_incorrect_password" : "User not found or incorrect password",
"User_or_channel_name" : "User or channel name",
"User_removed_by" : "User <em>__user_removed__</em> removed by <em>__user_by__</em>.",
"User_muted_by" : "User <em>__user_muted__</em> muted by <em>__user_by__</em>.",
"User_unmuted_by" : "User <em>__user_unmuted__</em> unmuted by <em>__user_by__</em>.",
"User_removed_from_room" : "The user has been removed from the room",
"User_Settings" : "User Settings",
"User_unmuted_by" : "User <em>__user_unmuted__</em> unmuted by <em>__user_by__</em>.",
"User_unmuted_in_room" : "User unmuted in room",
"User_updated_successfully" : "User updated successfully",
"Username" : "Username",
"Username_cant_be_empty" : "The username cannot be empty",
Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-ui/lib/fileUpload.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ readAsArrayBuffer = (file, callback) ->
timer: 1000
return

if file.file.size is 0
swal
title: t('FileUpload_File_Empty')
type: 'error'
timer: 1000
return

text = ''

if file.type is 'audio'
Expand Down

0 comments on commit f4da73e

Please sign in to comment.