mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 07:30:16 +08:00
Revert "Revert "FIX: Don't allow people to clear the upload bucket while it's enabled""
This reverts commit d4fc76b335
.
This commit is contained in:
parent
665d8564d8
commit
a5f61729e0
|
@ -143,6 +143,8 @@ module SiteSettings::Validations
|
||||||
|
|
||||||
def validate_s3_upload_bucket(new_val)
|
def validate_s3_upload_bucket(new_val)
|
||||||
validate_bucket_setting("s3_upload_bucket", new_val, SiteSetting.s3_backup_bucket)
|
validate_bucket_setting("s3_upload_bucket", new_val, SiteSetting.s3_backup_bucket)
|
||||||
|
|
||||||
|
validate_error(:s3_upload_bucket_is_required, setting_name: 's3_upload_bucket') if new_val.blank? && SiteSetting.enable_s3_uploads?
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_s3_backup_bucket(new_val)
|
def validate_s3_backup_bucket(new_val)
|
||||||
|
|
|
@ -103,6 +103,15 @@ describe SiteSettings::Validations do
|
||||||
SiteSetting.s3_backup_bucket = "my-awesome-bucket/foo"
|
SiteSetting.s3_backup_bucket = "my-awesome-bucket/foo"
|
||||||
expect { validate("my-awesome-bucket/foo/uploads") }.to raise_error(Discourse::InvalidParameters, error_message)
|
expect { validate("my-awesome-bucket/foo/uploads") }.to raise_error(Discourse::InvalidParameters, error_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "cannot be made blank unless the setting is false" do
|
||||||
|
SiteSetting.s3_backup_bucket = "really-real-cool-bucket"
|
||||||
|
SiteSetting.enable_s3_uploads = true
|
||||||
|
|
||||||
|
expect { validate("") }.to raise_error(Discourse::InvalidParameters)
|
||||||
|
SiteSetting.enable_s3_uploads = false
|
||||||
|
validate("")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user