mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 06:03:46 +08:00
FIX: Backup validation wasn't escaping hyphens
Conflicts: spec/controllers/admin/backups_controller_spec.rb
This commit is contained in:
parent
cbe623aaee
commit
69691fa7a6
|
@ -119,7 +119,7 @@ class Admin::BackupsController < Admin::AdminController
|
||||||
|
|
||||||
return render status: 415, text: I18n.t("backup.backup_file_should_be_tar_gz") unless /\.(tar\.gz|t?gz)$/i =~ filename
|
return render status: 415, text: I18n.t("backup.backup_file_should_be_tar_gz") unless /\.(tar\.gz|t?gz)$/i =~ filename
|
||||||
return render status: 415, text: I18n.t("backup.not_enough_space_on_disk") unless has_enough_space_on_disk?(total_size)
|
return render status: 415, text: I18n.t("backup.not_enough_space_on_disk") unless has_enough_space_on_disk?(total_size)
|
||||||
return render status: 415, text: I18n.t("backup.invalid_filename") unless !!(/^[a-zA-Z0-9\.-_]+$/ =~ filename)
|
return render status: 415, text: I18n.t("backup.invalid_filename") unless !!(/^[a-zA-Z0-9\._-]+$/ =~ filename)
|
||||||
|
|
||||||
file = params.fetch(:file)
|
file = params.fetch(:file)
|
||||||
identifier = params.fetch(:resumableIdentifier)
|
identifier = params.fetch(:resumableIdentifier)
|
||||||
|
|
|
@ -209,8 +209,8 @@ describe Admin::BackupsController do
|
||||||
describe "when filename is valid" do
|
describe "when filename is valid" do
|
||||||
it "should upload the file successfully" do
|
it "should upload the file successfully" do
|
||||||
xhr :post, :upload_backup_chunk,
|
xhr :post, :upload_backup_chunk,
|
||||||
resumableFilename: 'test.tar.gz',
|
resumableFilename: 'test_Site-0123456789.tar.gz',
|
||||||
resumableTotalSize: '1',
|
resumableTotalSize: 1,
|
||||||
resumableIdentifier: 'test',
|
resumableIdentifier: 'test',
|
||||||
resumableChunkNumber: '1',
|
resumableChunkNumber: '1',
|
||||||
resumableChunkSize: '1',
|
resumableChunkSize: '1',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user