mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat: cli multipart uploads (#33546)
This commit is contained in:
756
cli/Cargo.lock
generated
756
cli/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,7 @@ serde_json = "1.0.140"
|
||||
reqwest = { version = "0.12.14", features = [
|
||||
"blocking",
|
||||
"json",
|
||||
"multipart",
|
||||
"rustls-tls",
|
||||
], default-features = false }
|
||||
anyhow = "1.0.97"
|
||||
|
||||
@@ -72,18 +72,20 @@ fn upload_chunks(
|
||||
for upload in uploads {
|
||||
info!("Uploading chunk {}", upload.chunk_id);
|
||||
|
||||
let mut params = vec![("chunk_id", &upload.chunk_id)];
|
||||
let mut params: Vec<(&'static str, &str)> =
|
||||
vec![("chunk_id", &upload.chunk_id), ("multipart", "true")];
|
||||
if let Some(id) = &release_id {
|
||||
params.push(("release_id", id));
|
||||
}
|
||||
|
||||
let part = reqwest::blocking::multipart::Part::bytes(upload.data).file_name("file");
|
||||
let form = reqwest::blocking::multipart::Form::new().part("file", part);
|
||||
|
||||
let res = client
|
||||
.post(url)
|
||||
.multipart(form)
|
||||
.header("Authorization", format!("Bearer {}", token))
|
||||
.header("Content-Type", "application/octet-stream")
|
||||
.header("Content-Disposition", "attachment; filename='chunk'")
|
||||
.query(¶ms)
|
||||
.body(upload.data)
|
||||
.send()
|
||||
.context(format!("While uploading chunk to {}", url))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user