Skip to content

Commit

Permalink
Avoid pem::encode_many_config because of duplicate newlines
Browse files Browse the repository at this point in the history
We re-implement encode_many_config ourselves without the excess newlines
  • Loading branch information
omertuc committed Dec 5, 2023
1 parent 7f303bf commit f7a8f9a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cluster_crypto/pem_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ pub(crate) fn pem_bundle_replace_pem_at_index(original_pem_bundle: String, pem_i
newpems.push(pem.clone());
}
}
Ok(pem::encode_many_config(
&newpems,
pem::EncodeConfig::new().set_line_ending(pem::LineEnding::LF),
))

Ok(newpems
.iter()
.map(|value| pem::encode_config(value, pem::EncodeConfig::new().set_line_ending(pem::LineEnding::LF)))
.collect::<Vec<String>>()
.join(""))
}

0 comments on commit f7a8f9a

Please sign in to comment.