mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Support application/gzip theme imports, and improve error message
This commit is contained in:
parent
033cd4f31d
commit
77d26b9df6
@ -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
|
||||
|
||||
|
@ -80,6 +80,7 @@ en:
|
||||
about_json_values: "about.json contains invalid values: %{errors}"
|
||||
git: "Error cloning git repository, access is denied or repository is not found"
|
||||
unpack_failed: "Failed to unpack file"
|
||||
unknown_file_type: "The file you uploaded does not appear to be a valid Discourse theme."
|
||||
errors:
|
||||
component_no_user_selectable: "Theme components can't be user-selectable"
|
||||
component_no_default: "Theme components can't be default theme"
|
||||
|
Loading…
Reference in New Issue
Block a user