fix: client save logs item ID early, stores compression via proper field and size via update endpoint
- Client save now logs 'New item: {id}' immediately after server response
- Compression type sent as query param, stored in DB compression field (not _client_compression metadata)
- Client set_item_size() sends uncompressed size via POST /api/item/{id}/update?size=N
- Server raw content GET uses actual file size for Content-Length (not uncompressed item.size)
- Removed _client_compression metadata hack from client save and get
- Fixed server handle_update_item to support size-only updates
- Fixed clippy: collapsible_if, too_many_arguments, unnecessary mut refs
- Fixed ListItemsQuery doctest missing meta field
This commit is contained in:
@@ -341,6 +341,21 @@ impl KeepClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the uncompressed size for an item.
|
||||
pub fn set_item_size(&self, id: i64, size: u64) -> Result<(), CoreError> {
|
||||
let url = format!(
|
||||
"{}?size={}",
|
||||
self.url(&format!("/api/item/{id}/update")),
|
||||
size
|
||||
);
|
||||
let mut req = self.agent.post(&url);
|
||||
if let Some(ref auth) = self.auth_header() {
|
||||
req = req.header("Authorization", auth);
|
||||
}
|
||||
self.handle_error(req.send(ureq::SendBody::from_reader(&mut std::io::empty())))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_item_content_raw(&self, id: i64) -> Result<(Vec<u8>, String), CoreError> {
|
||||
let url = format!(
|
||||
"{}?decompress=false",
|
||||
|
||||
Reference in New Issue
Block a user