Skip to content

Commit

Permalink
Merge pull request #2019 from MushroomObserver/xxx
Browse files Browse the repository at this point in the history
Added some diagnostics.
  • Loading branch information
pellaea committed Mar 10, 2024
2 parents 898c32c + bb50cb4 commit ac37d48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ def input_stream?(file)

def init_image_from_local_file(file)
@file = file
raise("Weird: file.path is blank!") if file.path.blank?
self.upload_temp_file = file.path
self.upload_length = file.size
add_extra_attributes_from_file(file)
Expand Down Expand Up @@ -667,7 +668,7 @@ def validate_image_name
# to the :image field. Returns true if the file is successfully saved.
def save_to_temp_file
result = true
unless upload_temp_file
unless upload_temp_file.present?

# Image is supplied in a input stream. This can happen in a variety of
# cases, including during testing, and also when the image comes in as
Expand Down Expand Up @@ -702,7 +703,8 @@ def save_to_temp_file
else
errors.add(:image, "Unexpected error: did not receive a valid upload " \
"stream from the webserver (we got an instance of " \
"#{upload_handle.class.name}). Please try again.")
"#{upload_handle.class.name}). Send this to the " \
"webmaster, please. Backtrace: #{caller[0..20]}...")
result = false
end
end
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3622,7 +3622,7 @@
validate_user_email_missing: Please give us a valid email address so we can verify your [:account].
validate_user_email_mismatch: Your email addresses don't match. Please check for a typo.
validate_user_login_taken: Sorry, that login name is already taken.
validate_image_wrong_type: The file "[file]" is not a valid image; it is comes through as '[type]'.
validate_image_wrong_type: The file "[file]" is not a valid image; it comes through as '[type]'.
validate_invalid_lifeform: "Invalid lifeform word(s): [words]. We are strictly enforcing which types are allowed. If you would like us to add support to additional lifeforms, please contact the admins and make your case."

# These shouldn't need translating, but you are free to override if you need to.
Expand Down

0 comments on commit ac37d48

Please sign in to comment.