FIX: Skip validation when saving in `Upload#migrate_to_new_scheme`.

FIX: Skip validation when saving in Upload#migrate_to_new_scheme.

diff --git a/app/models/upload.rb b/app/models/upload.rb
index 4a53823..8e1b312 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -259,7 +259,7 @@ class Upload < ActiveRecord::Base
           File.open(path) do |f|
             upload.url = Discourse.store.store_upload(f, upload)
             upload.filesize = f.size
-            upload.save!
+            upload.save!(validate: false)
           end
           # remap the URLs
           DbHelper.remap(UrlHelper.absolute(previous_url), upload.url) unless external

GitHub sha: 0ac6a58b

Why do we need to skip the validation?

The upload may have a format that is no longer allowed as part of the site settings.

1 Like

Two :+1: for me :grinning:

1 Like