Skip to content

Commit

Permalink
Escape double-quotes in labels, and suppress labels with value nil (#928
Browse files Browse the repository at this point in the history
)

Fixes #927
  • Loading branch information
candlerb authored and cyriltovena committed Sep 17, 2019
1 parent 04a615a commit 35d5a15
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ def labels_to_protocol(data_labels)
data_labels = {} if data_labels.nil?
data_labels = data_labels.merge(@extra_labels)

unless data_labels.nil?
data_labels.each do |k, v|
formatted_labels.push("#{k}=\"#{v}\"")
end
data_labels.each do |k, v|
formatted_labels.push("#{k}=\"#{v.gsub('"','\\"')}\"") if v
end
'{' + formatted_labels.join(',') + '}'
end
Expand Down

0 comments on commit 35d5a15

Please sign in to comment.