Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b3208976
Commit
b3208976
authored
Jan 07, 2021
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 500 errors entering a webhook URL not encoded
parent
473cf7c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
app/services/web_hook_service.rb
app/services/web_hook_service.rb
+3
-1
doc/user/project/integrations/webhooks.md
doc/user/project/integrations/webhooks.md
+1
-1
spec/services/web_hook_service_spec.rb
spec/services/web_hook_service_spec.rb
+9
-0
No files found.
app/services/web_hook_service.rb
View file @
b3208976
...
...
@@ -54,7 +54,9 @@ class WebHookService
http_status:
response
.
code
,
message:
response
.
to_s
}
rescue
SocketError
,
OpenSSL
::
SSL
::
SSLError
,
Errno
::
ECONNRESET
,
Errno
::
ECONNREFUSED
,
Errno
::
EHOSTUNREACH
,
Net
::
OpenTimeout
,
Net
::
ReadTimeout
,
Gitlab
::
HTTP
::
BlockedUrlError
,
Gitlab
::
HTTP
::
RedirectionTooDeep
,
Gitlab
::
Json
::
LimitedEncoder
::
LimitExceeded
=>
e
rescue
SocketError
,
OpenSSL
::
SSL
::
SSLError
,
Errno
::
ECONNRESET
,
Errno
::
ECONNREFUSED
,
Errno
::
EHOSTUNREACH
,
Net
::
OpenTimeout
,
Net
::
ReadTimeout
,
Gitlab
::
HTTP
::
BlockedUrlError
,
Gitlab
::
HTTP
::
RedirectionTooDeep
,
Gitlab
::
Json
::
LimitedEncoder
::
LimitExceeded
,
URI
::
InvalidURIError
=>
e
execution_duration
=
Gitlab
::
Metrics
::
System
.
monotonic_time
-
start_time
log_execution
(
trigger:
hook_name
,
...
...
doc/user/project/integrations/webhooks.md
View file @
b3208976
...
...
@@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Webhooks
Project webhooks allow you to trigger a URL if for example new code is pushed or
Project webhooks allow you to trigger a URL
-encoded
if for example new code is pushed or
a new issue is created. You can configure webhooks to listen for specific events
like pushes, issues or merge requests. GitLab sends a POST request with data
to the webhook URL.
...
...
spec/services/web_hook_service_spec.rb
View file @
b3208976
...
...
@@ -131,6 +131,15 @@ RSpec.describe WebHookService do
end
end
context
'when url is not encoded'
do
let
(
:project_hook
)
{
create
(
:project_hook
,
url:
'http://server.com/my path/'
)
}
it
'handles exceptions'
do
expect
(
service_instance
.
execute
).
to
eq
(
status: :error
,
message:
'bad URI(is not URI?): "http://server.com/my path/"'
)
expect
{
service_instance
.
execute
}.
not_to
raise_error
end
end
context
'when request body size is too big'
do
it
'does not perform the request'
do
stub_const
(
"
#{
described_class
}
::REQUEST_BODY_SIZE_LIMIT"
,
10
.
bytes
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment