From 941f081ce6df9a3cf87369f61fdfa4df48079e7c Mon Sep 17 00:00:00 2001 From: taoky Date: Wed, 4 Dec 2024 17:48:06 +0800 Subject: [PATCH] homebrew-bottles: Encode url in list cask source --- homebrew-bottles/bottles-json/Cargo.lock | 9 ++++++++- homebrew-bottles/bottles-json/Cargo.toml | 2 +- homebrew-bottles/bottles-json/src/main.rs | 6 ++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/homebrew-bottles/bottles-json/Cargo.lock b/homebrew-bottles/bottles-json/Cargo.lock index b5699e2..7fff2a0 100644 --- a/homebrew-bottles/bottles-json/Cargo.lock +++ b/homebrew-bottles/bottles-json/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "bitflags" @@ -15,6 +15,7 @@ dependencies = [ "clap", "serde", "serde_json", + "urlencoding", ] [[package]] @@ -253,6 +254,12 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "version_check" version = "0.9.4" diff --git a/homebrew-bottles/bottles-json/Cargo.toml b/homebrew-bottles/bottles-json/Cargo.toml index 2ad9b85..33e84ba 100644 --- a/homebrew-bottles/bottles-json/Cargo.toml +++ b/homebrew-bottles/bottles-json/Cargo.toml @@ -11,4 +11,4 @@ strip = "symbols" clap = { version = "4.1.4", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" - +urlencoding = "2.1.3" diff --git a/homebrew-bottles/bottles-json/src/main.rs b/homebrew-bottles/bottles-json/src/main.rs index 14c625d..e76d975 100644 --- a/homebrew-bottles/bottles-json/src/main.rs +++ b/homebrew-bottles/bottles-json/src/main.rs @@ -155,9 +155,11 @@ fn main() { .unwrap() .to_str() .unwrap(); + let url = format!("https://formulae.brew.sh/api/cask-source/{}", filename); + let url = urlencoding::encode(&url); println!( - "{} https://formulae.brew.sh/api/cask-source/{} {}", - f.ruby_source_checksum.sha256, filename, filename + "{} {} {}", + f.ruby_source_checksum.sha256, url, filename ); } }