From f28fde5e58981c14ed06d54fcfbb5106b407415a Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 15 Apr 2024 13:06:20 -0400 Subject: [PATCH] Move constraints to query parameters for `GET /extensions/:extension_id/download` (#10562) This PR fixes a bug where the constraints provided when downloading the latest version of an extension were not being read properly. These constraints are passed in the query string, but `collab` was attempting to read them from the path. This should fix https://github.com/zed-industries/zed/issues/10484, once it is deployed. Release Notes: - N/A --- crates/collab/src/api/extensions.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/collab/src/api/extensions.rs b/crates/collab/src/api/extensions.rs index fd0909a2f4..20e35ec28d 100644 --- a/crates/collab/src/api/extensions.rs +++ b/crates/collab/src/api/extensions.rs @@ -106,8 +106,12 @@ async fn get_extension_versions( } #[derive(Debug, Deserialize)] -struct DownloadLatestExtensionParams { +struct DownloadLatestExtensionPathParams { extension_id: String, +} + +#[derive(Debug, Deserialize)] +struct DownloadLatestExtensionQueryParams { min_schema_version: Option, max_schema_version: Option, min_wasm_api_version: Option, @@ -116,13 +120,14 @@ struct DownloadLatestExtensionParams { async fn download_latest_extension( Extension(app): Extension>, - Path(params): Path, + Path(params): Path, + Query(query): Query, ) -> Result { let constraints = maybe!({ - let min_schema_version = params.min_schema_version?; - let max_schema_version = params.max_schema_version?; - let min_wasm_api_version = params.min_wasm_api_version?; - let max_wasm_api_version = params.max_wasm_api_version?; + let min_schema_version = query.min_schema_version?; + let max_schema_version = query.max_schema_version?; + let min_wasm_api_version = query.min_wasm_api_version?; + let max_wasm_api_version = query.max_wasm_api_version?; Some(ExtensionVersionConstraints { schema_versions: min_schema_version..=max_schema_version,