FIX: store the topic links using the cooked upload url

This commit is contained in:
Régis Hanol
2018-08-14 12:23:32 +02:00
parent ad5f502332
commit de92913bf4
31 changed files with 116 additions and 110 deletions

View File

@ -4,7 +4,7 @@ class UploadUrlValidator < ActiveModel::EachValidator
uri =
begin
URI.parse(value)
rescue URI::InvalidURIError
rescue URI::Error
end
unless uri && Upload.exists?(url: value)

View File

@ -5,7 +5,7 @@ class UrlValidator < ActiveModel::EachValidator
begin
uri = URI.parse(value)
uri.is_a?(URI::HTTP) && !uri.host.nil? && uri.host.include?(".")
rescue URI::InvalidURIError => e
rescue URI::Error => e
if (e.message =~ /URI must be ascii only/)
value = URI.encode(value)
retry