Commit ed60b6fc90ed21b7375ef9822fee61eee2fc6d0e
Exists in
master
and in
4 other branches
Merge pull request #3071 from dmedvinsky/fix-webhook-auth
Fix WebHook and special symbols in credentials
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
app/models/web_hook.rb
@@ -28,10 +28,14 @@ class WebHook < ActiveRecord::Base | @@ -28,10 +28,14 @@ class WebHook < ActiveRecord::Base | ||
28 | WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) | 28 | WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) |
29 | else | 29 | else |
30 | post_url = url.gsub("#{parsed_url.userinfo}@", "") | 30 | post_url = url.gsub("#{parsed_url.userinfo}@", "") |
31 | + auth = { | ||
32 | + username: URI.decode(parsed_url.user), | ||
33 | + password: URI.decode(parsed_url.password), | ||
34 | + } | ||
31 | WebHook.post(post_url, | 35 | WebHook.post(post_url, |
32 | body: data.to_json, | 36 | body: data.to_json, |
33 | headers: {"Content-Type" => "application/json"}, | 37 | headers: {"Content-Type" => "application/json"}, |
34 | - basic_auth: {username: parsed_url.user, password: parsed_url.password}) | 38 | + basic_auth: auth) |
35 | end | 39 | end |
36 | end | 40 | end |
37 | 41 |