summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-04-18 00:51:59 +0200
committerCyborus <cyborus@cyborus.xyz>2024-04-18 00:51:59 +0200
commit40b9454e8b22ac4608a0ea1219c8418dc3a94fe9 (patch)
tree724ee269e488c3143e445adc831c374dfb06e867 /src/lib.rs
parentMerge pull request 'Auto-generate API' (#38) from autogen into main (diff)
downloadforgejo-api-40b9454e8b22ac4608a0ea1219c8418dc3a94fe9.tar.xz
forgejo-api-40b9454e8b22ac4608a0ea1219c8418dc3a94fe9.zip
fix release attachment download url
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 161aac1..3a53fcb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -144,10 +144,12 @@ impl Forgejo {
let release = self
.repo_get_release_attachment(owner, repo, release, attach)
.await?;
- let request = self
- .client
- .get(format!("/attachments/{}", release.uuid.unwrap()))
- .build()?;
+ let mut url = self.url.clone();
+ url.path_segments_mut()
+ .unwrap()
+ .pop_if_empty()
+ .extend(["attachments", &release.uuid.unwrap().to_string()]);
+ let request = self.client.get(url).build()?;
Ok(self.execute(request).await?.bytes().await?)
}