diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rb index d2d2cfe9642..d84fddce302 100644 --- a/app/jobs/scheduled/clean_up_uploads.rb +++ b/app/jobs/scheduled/clean_up_uploads.rb @@ -4,14 +4,14 @@ module Jobs def execute(args) grace_period = [SiteSetting.clean_orphan_uploads_grace_period_hours, 1].max - + # always remove invalid upload records Upload .where("retain_hours IS NULL OR created_at < current_timestamp - interval '1 hour' * retain_hours") .where("created_at < ?", grace_period.hour.ago) .where(url: "") .destroy_all - + return unless SiteSetting.clean_up_uploads? base_url = Discourse.store.internal? ? Discourse.store.relative_base_url : Discourse.store.absolute_base_url