@@ -22,7 +22,7 @@ use crate::{
2222 } ,
2323 load:: load,
2424 save:: save,
25- utils:: { LookupError , find_file_matching_file} ,
25+ utils:: { LookupError , find_file_matching_file, normalize_uri } ,
2626} ;
2727
2828mod annotate;
@@ -119,7 +119,8 @@ async fn main() -> Result<()> {
119119 Some ( "info" ) => info:: info ( ) ,
120120 Some ( "pull" ) => {
121121 if let Some ( matches) = matches. subcommand_matches ( "pull" ) {
122- let uri = matches. get_one :: < String > ( "uri" ) . unwrap ( ) ;
122+ let uri = normalize_uri ( matches. get_one :: < String > ( "uri" ) . unwrap ( ) ) ;
123+ let uri = & uri;
123124 let destination = matches
124125 . get_one :: < String > ( "output-path" )
125126 . map ( |output| PathBuf :: from_str ( output) . unwrap ( ) ) ;
@@ -133,7 +134,8 @@ async fn main() -> Result<()> {
133134 }
134135 Some ( "verify" ) => {
135136 if let Some ( matches) = matches. subcommand_matches ( "verify" ) {
136- let uri = matches. get_one :: < String > ( "uri" ) . unwrap ( ) ;
137+ let uri = normalize_uri ( matches. get_one :: < String > ( "uri" ) . unwrap ( ) ) ;
138+ let uri = uri. as_str ( ) ;
137139 let sources = remote_server_options ( matches) ?;
138140 let verification_options = build_verification_options ( matches) ?
139141 . ok_or_else ( || anyhow ! ( "could not retrieve sigstore options" ) ) ?;
@@ -193,8 +195,9 @@ async fn main() -> Result<()> {
193195 }
194196 Some ( "rm" ) => {
195197 if let Some ( matches) = matches. subcommand_matches ( "rm" ) {
196- let uri_or_sha_prefix = matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ;
197- rm:: rm ( uri_or_sha_prefix) ?;
198+ let uri_or_sha_prefix =
199+ normalize_uri ( matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ) ;
200+ rm:: rm ( & uri_or_sha_prefix) ?;
198201 }
199202 Ok ( ( ) )
200203 }
@@ -233,7 +236,8 @@ async fn main() -> Result<()> {
233236 }
234237 Some ( "inspect" ) => {
235238 if let Some ( matches) = matches. subcommand_matches ( "inspect" ) {
236- let uri_or_sha_prefix = matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ;
239+ let uri_or_sha_prefix =
240+ normalize_uri ( matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ) ;
237241 let output = inspect:: OutputType :: try_from (
238242 matches. get_one :: < String > ( "output" ) . map ( |s| s. as_str ( ) ) ,
239243 ) ?;
@@ -242,7 +246,7 @@ async fn main() -> Result<()> {
242246 . get_one :: < bool > ( "show-signatures" )
243247 . unwrap_or ( & false )
244248 . to_owned ( ) ;
245- inspect:: inspect ( uri_or_sha_prefix, output, sources, no_color, no_signatures)
249+ inspect:: inspect ( & uri_or_sha_prefix, output, sources, no_color, no_signatures)
246250 . await ?;
247251 } ;
248252 Ok ( ( ) )
@@ -446,7 +450,8 @@ async fn pull_command(
446450 * This function will pull the policy if it is not already present in the local store.
447451 */
448452async fn scaffold_manifest_command ( matches : & ArgMatches ) -> Result < ( ) > {
449- let uri_or_sha_prefix = matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ;
453+ let uri_or_sha_prefix = normalize_uri ( matches. get_one :: < String > ( "uri_or_sha_prefix" ) . unwrap ( ) ) ;
454+ let uri_or_sha_prefix = uri_or_sha_prefix. as_str ( ) ;
450455
451456 pull_if_needed ( uri_or_sha_prefix, matches) . await ?;
452457
0 commit comments