Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit a5f1cb76 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

api/projects: escape branch names when unprotecting

parent 42a4c705
......@@ -22,6 +22,8 @@ been added.
* The `api::projects::members::ProjectMembers` and
`api::projects::repository::Branches` endpoints now accepts plain strings
for their `query` fields.
* The `api::projects::protected_branches::UnprotectBranch` endpoint now
properly escapes branch names with URL-special characters.
## Changes
......
......@@ -48,7 +48,7 @@ These API endpoints have been implemented.
* `POST /projects/:project/pipelines/:pipeline/retry` `projects/pipelines/retry.rs`
* `GET /projects/:project/pipelines/:pipeline/variables` `projects/pipelines/variables.rs`
* `POST /projects/:project/protected_branches` `projects/protected_branches/protect.rs`
* `DELETE /projects/:project/protected_branches/:branch` `projects/protected_branches/unprotect.rs`
* `DELETE /projects/:project/protected_branches/*branch` `projects/protected_branches/unprotect.rs`
* `GET /projects/:project/repository/branches` `projects/repository/branches/branches.rs`
* `POST /projects/:project/repository/branches` `projects/repository/branches/create.rs`
* `GET /projects/:project/repository/branches/:branch` `projects/repository/branches/branch.rs`
......
......@@ -8,7 +8,7 @@ use std::borrow::Cow;
use derive_builder::Builder;
use crate::api::common::NameOrId;
use crate::api::common::{self, NameOrId};
use crate::api::endpoint_prelude::*;
/// Create a new file in a project.
......@@ -35,7 +35,12 @@ impl<'a> Endpoint for UnprotectBranch<'a> {
}
fn endpoint(&self) -> Cow<'static, str> {
format!("projects/{}/protected_branches/{}", self.project, self.name).into()
format!(
"projects/{}/protected_branches/{}",
self.project,
common::path_escaped(&self.name),
)
.into()
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment