FIX: uploads rake tasks to support subfolders

This commit is contained in:
Régis Hanol 2015-05-12 09:28:43 +02:00
parent f4cb96ff9a
commit b489384b59

View file

@ -175,7 +175,7 @@ task "uploads:missing" => :environment do
Upload.order(:id).find_each do |upload|
# could be a remote image
next unless upload.url =~ /^\/uploads\//
next unless upload.url =~ /^\/[^\/]/
path = "#{public_directory}#{upload.url}"
bad = true
@ -190,7 +190,7 @@ task "uploads:missing" => :environment do
OptimizedImage.order(:id).find_each do |optimized_image|
# remote?
next unless optimized_image.url =~ /^\/uploads\//
next unless optimized_image.url =~ /^\/[^\/]/
path = "#{public_directory}#{optimized_image.url}"
@ -237,8 +237,8 @@ def regenerate_missing_optimized
upload = optimized_image.upload
next unless optimized_image.url =~ /^\/uploads\//
next unless upload.url =~ /^\/uploads\//
next unless optimized_image.url =~ /^\/[^\/]/
next unless upload.url =~ /^\/[^\/]/
thumbnail = "#{public_directory}#{optimized_image.url}"
original = "#{public_directory}#{upload.url}"