Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Jul 18, 2023
1 parent 1f727c1 commit 3412ebb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions data/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ const (
// MaxFieldLength defines the maximum length for a keyword field, approximating the maximum length of the keyword type.
MaxFieldLength = 30000

// MaxLengthForBase64EncodedFields defines the maximum length for a keyboard field that will be base64 encoded
MaxLengthForBase64EncodedFields = 22500
// MaxKeywordFieldLengthBeforeBase64Encoding defines the maximum length for a keyword field that will be base64 encoded
MaxKeywordFieldLengthBeforeBase64Encoding = 22500
)
6 changes: 3 additions & 3 deletions process/elasticproc/converters/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ func TruncateFieldIfExceedsMaxLength(field string) string {
return field
}

// TruncateFieldIfExceedsMaxLengthBase64 will truncate the provided field if the max length exceeds
// TruncateFieldIfExceedsMaxLengthBase64 will truncate the provided field if the max length after base64 encoding would be exceeded
// this function will be used for the fields that after will be base64 encoded
func TruncateFieldIfExceedsMaxLengthBase64(field string) string {
if len(field) > data.MaxLengthForBase64EncodedFields {
return field[:data.MaxLengthForBase64EncodedFields]
if len(field) > data.MaxKeywordFieldLengthBeforeBase64Encoding {
return field[:data.MaxKeywordFieldLengthBeforeBase64Encoding]
}

return field
Expand Down

0 comments on commit 3412ebb

Please sign in to comment.