mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-17 18:04:37 +00:00
0.8.4 release (#3819)
* chore: prepare 0.8.4 release * fix(postgres): send `limit: 0` for all `Execute` messages fixes #3673 * fix: let `CertificateInput::from` infer any PEM-encoded document https://github.com/launchbadge/sqlx/pull/3809#issuecomment-2800293813 * doc: improve documentation of `PgConnectOptions` fixes #3740 * chore: update CHANGELOG from PR
This commit is contained in:
@@ -25,11 +25,12 @@ pub enum CertificateInput {
|
||||
|
||||
impl From<String> for CertificateInput {
|
||||
fn from(value: String) -> Self {
|
||||
// Leading and trailing whitespace/newlines
|
||||
let trimmed = value.trim();
|
||||
// Some heuristics according to https://tools.ietf.org/html/rfc7468
|
||||
if trimmed.starts_with("-----BEGIN CERTIFICATE-----")
|
||||
&& trimmed.contains("-----END CERTIFICATE-----")
|
||||
{
|
||||
|
||||
// Heuristic for PEM encoded inputs:
|
||||
// https://tools.ietf.org/html/rfc7468
|
||||
if trimmed.starts_with("-----BEGIN") && trimmed.ends_with("-----") {
|
||||
CertificateInput::Inline(value.as_bytes().to_vec())
|
||||
} else {
|
||||
CertificateInput::File(PathBuf::from(value))
|
||||
|
||||
Reference in New Issue
Block a user