Strip source whitespace before upload
This was already done for post edits but not on upload.
This commit is contained in:
@@ -102,6 +102,7 @@ class Upload < ActiveRecord::Base
|
|||||||
def process_once
|
def process_once
|
||||||
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
||||||
update_attribute(:status, "processing")
|
update_attribute(:status, "processing")
|
||||||
|
self.source = strip_source
|
||||||
if is_downloadable?
|
if is_downloadable?
|
||||||
self.source = download_from_source(temp_file_path)
|
self.source = download_from_source(temp_file_path)
|
||||||
end
|
end
|
||||||
@@ -379,6 +380,10 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
module DownloaderMethods
|
module DownloaderMethods
|
||||||
|
def strip_source
|
||||||
|
source.try(:strip)
|
||||||
|
end
|
||||||
|
|
||||||
# Determines whether the source is downloadable
|
# Determines whether the source is downloadable
|
||||||
def is_downloadable?
|
def is_downloadable?
|
||||||
source =~ /^https?:\/\// && file_path.blank?
|
source =~ /^https?:\/\// && file_path.blank?
|
||||||
|
|||||||
Reference in New Issue
Block a user