From 63ac5e4561512d4019a4c7de16281f5819f66e49 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 20:23:15 +0000 Subject: [PATCH] clap-utils: trim single-quotes from signer uris on windows (#20695) (cherry picked from commit 6649dfa8999db8a93d432830044b19bb01bd3c20) Co-authored-by: Trent Nelson --- clap-utils/src/keypair.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clap-utils/src/keypair.rs b/clap-utils/src/keypair.rs index f63227043d..100a7bd15a 100644 --- a/clap-utils/src/keypair.rs +++ b/clap-utils/src/keypair.rs @@ -258,6 +258,15 @@ pub(crate) fn parse_signer_source>( let source = { #[cfg(target_family = "windows")] { + // trim matched single-quotes since cmd.exe won't + let mut source = source; + while let Some(trimmed) = source.strip_prefix('\'') { + source = if let Some(trimmed) = trimmed.strip_suffix('\'') { + trimmed + } else { + break; + } + } source.replace("\\", "/") } #[cfg(not(target_family = "windows"))]