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.

(cherry picked from commit aafff49)
  • Loading branch information
jsoriano committed Sep 27, 2018
1 parent e193f6d commit f9a1e6e
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 @@ -34,6 +34,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"
)
Expand Down Expand Up @@ -76,7 +77,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 f9a1e6e

Please sign in to comment.