Skip to content

Commit

Permalink
Move constraints to query parameters for `GET /extensions/:extension_…
Browse files Browse the repository at this point in the history
…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 #10484, once
it is deployed.


Release Notes:

- N/A
  • Loading branch information
maxdeviant committed Apr 15, 2024
1 parent d1928f0 commit f28fde5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions crates/collab/src/api/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
max_schema_version: Option<i32>,
min_wasm_api_version: Option<SemanticVersion>,
Expand All @@ -116,13 +120,14 @@ struct DownloadLatestExtensionParams {

async fn download_latest_extension(
Extension(app): Extension<Arc<AppState>>,
Path(params): Path<DownloadLatestExtensionParams>,
Path(params): Path<DownloadLatestExtensionPathParams>,
Query(query): Query<DownloadLatestExtensionQueryParams>,
) -> Result<Redirect> {
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,
Expand Down

0 comments on commit f28fde5

Please sign in to comment.