FIX: Support application/gzip theme imports, and improve error message

This commit is contained in:
David Taylor
2019-01-28 11:51:14 +00:00
parent 033cd4f31d
commit 77d26b9df6
2 changed files with 3 additions and 2 deletions

View File

@ -84,7 +84,7 @@ class Admin::ThemesController < Admin::AdminController
rescue RemoteTheme::ImportError => e
render_json_error e.message
end
elsif params[:bundle] || params[:theme] && params[:theme].content_type == "application/x-gzip"
elsif params[:bundle] || params[:theme] && ["application/x-gzip", "application/gzip"].include?(params[:theme].content_type)
# params[:bundle] used by theme CLI. params[:theme] used by admin UI
bundle = params[:bundle] || params[:theme]
begin
@ -95,7 +95,7 @@ class Admin::ThemesController < Admin::AdminController
render_json_error e.message
end
else
render_json_error status: :unprocessable_entity
render_json_error I18n.t("themes.import_error.unknown_file_type"), status: :unprocessable_entity
end
end