Skip to content

Commit

Permalink
Remove line carriages on asset generation (elastic#8464)
Browse files Browse the repository at this point in the history
On Windows, asset files can contain line carriages, what leads to
different encoded assets. Remove these carriages between encoding the
string.
  • Loading branch information
jsoriano authored Sep 27, 2018
1 parent a1ce2e9 commit 97927b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-developer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The list below covers the major changes between 6.3.0 and master only.

- Fix permissions of generated Filebeat filesets. {pull}7140[7140]
- Collect fields from _meta/fields.yml too. {pull}8397[8397]
- Fix issue on asset generation that could lead to different results in Windows. {pull}8464[8464]

==== Added

Expand Down
5 changes: 4 additions & 1 deletion dev-tools/cmd/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"go/format"
"io/ioutil"
"os"
"strings"

"github.com/elastic/beats/libbeat/asset"
"github.com/elastic/beats/licenses"
Expand Down Expand Up @@ -79,7 +80,9 @@ func main() {
}
}

encData, err := asset.EncodeData(string(data))
// Depending on OS or tools configuration, files can contain carriages (\r),
// what leads to different results, remove them before encoding.
encData, err := asset.EncodeData(strings.Replace(string(data), "\r", "", -1))
if err != nil {
fmt.Fprintf(os.Stderr, "Error encoding the data: %s\n", err)
os.Exit(1)
Expand Down

0 comments on commit 97927b9

Please sign in to comment.