Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/harbor/root/webhook/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ or leave them out and be guided through an interactive prompt to input each fiel
opts.NotifyType != "" &&
len(opts.EventType) != 0 &&
opts.EndpointURL != "" {
err = utils.ValidateURL(opts.EndpointURL)
formattedURL := utils.FormatUrl(opts.EndpointURL)
err = utils.ValidateURL(formattedURL)
if err != nil {
return err
}
opts.EndpointURL = formattedURL
err = api.CreateWebhook(&opts)
} else {
err = createWebhookView(createView)
Expand Down
5 changes: 4 additions & 1 deletion cmd/harbor/root/webhook/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ or leave them out and use the interactive prompt to select and update a webhook.
opts.NotifyType != "" &&
len(opts.EventType) != 0 &&
opts.EndpointURL != "" {
if err := utils.ValidateURL(opts.EndpointURL); err != nil {
formattedURL := utils.FormatUrl(opts.EndpointURL)
if err := utils.ValidateURL(formattedURL); err != nil {
return err
}
opts.EndpointURL = formattedURL
err = api.UpdateWebhook(&opts)

} else {
err = editWebhookView(editView)
}
Expand Down
Loading