mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 04:34:32 +08:00
DEV: Replace silent theme-install fails with exceptions (#28485)
Previously, we were silently failing when a theme hit SSRF protection, or the `git clone` command failed for some reason. This commit updates them to be exceptions, so they provide more useful error messages
This commit is contained in:
parent
a69f3a0880
commit
58c4528a1c
|
@ -115,20 +115,21 @@ class ThemeStore::GitImporter < ThemeStore::BaseImporter
|
||||||
|
|
||||||
addresses = FinalDestination::SSRFDetector.lookup_and_filter_ips(uri.host)
|
addresses = FinalDestination::SSRFDetector.lookup_and_filter_ips(uri.host)
|
||||||
|
|
||||||
unless addresses.empty?
|
raise_import_error! if addresses.empty?
|
||||||
env = { "GIT_TERMINAL_PROMPT" => "0" }
|
|
||||||
|
|
||||||
args =
|
env = { "GIT_TERMINAL_PROMPT" => "0" }
|
||||||
clone_args(
|
|
||||||
uri.to_s,
|
|
||||||
"http.followRedirects" => "false",
|
|
||||||
"http.curloptResolve" => "#{uri.host}:#{uri.port}:#{addresses.join(",")}",
|
|
||||||
)
|
|
||||||
|
|
||||||
begin
|
args =
|
||||||
Discourse::Utils.execute_command(env, *args, timeout: COMMAND_TIMEOUT_SECONDS)
|
clone_args(
|
||||||
rescue RuntimeError
|
uri.to_s,
|
||||||
end
|
"http.followRedirects" => "false",
|
||||||
|
"http.curloptResolve" => "#{uri.host}:#{uri.port}:#{addresses.join(",")}",
|
||||||
|
)
|
||||||
|
|
||||||
|
begin
|
||||||
|
Discourse::Utils.execute_command(env, *args, timeout: COMMAND_TIMEOUT_SECONDS)
|
||||||
|
rescue RuntimeError
|
||||||
|
raise_import_error!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user