'uploads:gather' should only work on local uploads

This commit is contained in:
Régis Hanol 2016-04-11 21:17:33 +02:00
parent 7783ba46fc
commit 71fe66c8c2

View File

@ -12,7 +12,9 @@ task "uploads:gather" => :environment do
puts "", "Gathering uploads for '#{current_db}'...", ""
Upload.where("url !~ '^\/uploads\/#{current_db}'").find_each do |upload|
Upload.where("url ~ '^\/uploads\/'")
.where("url !~ '^\/uploads\/#{current_db}'")
.find_each do |upload|
begin
old_db = upload.url[/^\/uploads\/([^\/]+)\//, 1]
from = upload.url.dup