uploads: improve error messages.

Improve upload error messages when downloading an URL fails, or it isn't
an image or video file.
This commit is contained in:
evazion
2022-02-15 18:04:53 -06:00
parent 87a00a1182
commit e4d7453180
4 changed files with 3 additions and 5 deletions

View File

@@ -219,9 +219,7 @@ module Sources
# Download the file at the given url, or at the main image url by default.
def download_file!(download_url = image_url)
raise DownloadError, "Download failed: couldn't find download url for #{url}" if download_url.blank?
response, file = http_downloader.download_media(download_url)
raise DownloadError, "Download failed: #{download_url} returned error #{response.status}" if response.status != 200
file
end