FIX: Abort theme creation if unable to create uploads (#16336)

Previous to this change if any of the assets were not allowed extensions
they would simply be silently ignored, this could lead to broken themes
that are very hard to debug
This commit is contained in:
Sam
2022-04-01 12:03:14 +11:00
committed by GitHub
parent e7c3d01aaa
commit b023d88b09
3 changed files with 16 additions and 0 deletions

View File

@ -151,6 +151,16 @@ describe Admin::ThemesController do
expect(UserHistory.where(action: UserHistory.actions[:change_theme]).count).to eq(1)
end
it 'fails to import with an error if uploads are not allowed' do
SiteSetting.theme_authorized_extensions = "nothing"
expect do
post "/admin/themes/import.json", params: { theme: theme_archive }
end.to change { Theme.count }.by (0)
expect(response.status).to eq(422)
end
it 'imports a theme from an archive' do
_existing_theme = Fabricate(:theme, name: "Header Icons")