Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid double slash when join url and path (#5503) #5517

Merged
merged 5 commits into from
Nov 9, 2017
Merged
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: 2 additions & 2 deletions libbeat/outputs/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var (
errExpectedItemObject = errors.New("expected item response object")
errExpectedStatusCode = errors.New("expected item status code")
errUnexpectedEmptyObject = errors.New("empty object")
errExcpectedObjectEnd = errors.New("expected end of object")
errExpectedObjectEnd = errors.New("expected end of object")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup

errTempBulkFailure = errors.New("temporary bulk send failure")
)

Expand Down Expand Up @@ -505,7 +505,7 @@ func itemStatus(reader *jsonReader) (int, []byte, error) {
return 0, nil, err
}
if kind != dictEnd {
err = errExcpectedObjectEnd
err = errExpectedObjectEnd
logp.Err("Failed to parse bulk response item: %s", err)
return 0, nil, err
}
Expand Down
3 changes: 3 additions & 0 deletions libbeat/outputs/elasticsearch/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
)

func addToURL(url, path, pipeline string, params map[string]string) string {
if (strings.HasSuffix(url, "/") && strings.HasPrefix(path, "/")) {
url = strings.TrimSuffix(url, "/")
}
if len(params) == 0 && pipeline == "" {
return url + path
}
Expand Down