diff --git a/UPSTREAM_SYNC.md b/UPSTREAM_SYNC.md index 7952634..1cc80d1 100644 --- a/UPSTREAM_SYNC.md +++ b/UPSTREAM_SYNC.md @@ -6,8 +6,8 @@ gitignored, so this file is the only durable record of what we last reviewed. - **Upstream**: https://github.com/ProtonDriveApps/sdk - **Reconciled subtree**: `client/cs/sdk/src` -- **Pinned**: `36430318919c30fac42ec8577036a6d6e9de916f` -- **Date**: 2026-06-26 +- **Pinned**: `f2496161c2f704b72511aa1b804961285993850c` +- **Date**: 2026-07-10 ## Workflow @@ -23,3 +23,4 @@ gitignored, so this file is the only durable record of what we last reviewed. |------|-----------|--------|-------| | 2026-06-25 | initial pin `fb4173ab` | — | baseline; delta reviewed, 0 behavioral changes outstanding | | 2026-06-26 | `fb4173ab` → `36430318` | `36430318` | ported: enumeration returns `NodeUid`s (`enumerate_folder_children_node_uids` / `enumerate_trash_node_uids`), caller materializes via `enumerate_nodes`. noise dropped: BOM/deps/kt-enum-order/cs-account-refactor | +| 2026-07-10 | `36430318` → `f2496161` | `9a1c39b3` | ported: validation check in `Thumbnail::new` returning `Result` instead of panicking. noise dropped: projects reorg / C# Account client move to incubating. deferred: device support (`32a8eed0`). | diff --git a/crates/proton-drive-rs/src/node.rs b/crates/proton-drive-rs/src/node.rs index 4384ab9..afba0d6 100644 --- a/crates/proton-drive-rs/src/node.rs +++ b/crates/proton-drive-rs/src/node.rs @@ -138,11 +138,21 @@ pub struct Thumbnail { impl Thumbnail { /// Create a thumbnail from rendered image bytes. - pub fn new(thumbnail_type: ThumbnailType, content: Vec) -> Self { - Self { + /// + /// Returns an error if the `content` is empty. + pub fn new( + thumbnail_type: ThumbnailType, + content: Vec, + ) -> Result { + if content.is_empty() { + return Err(proton_sdk::error::ProtonError::invalid_operation( + "Thumbnail content must not be empty.", + )); + } + Ok(Self { thumbnail_type, content, - } + }) } } diff --git a/crates/proton-drive-rs/tests/live_transfer_ops.rs b/crates/proton-drive-rs/tests/live_transfer_ops.rs index c795a2d..aaa2ff4 100644 --- a/crates/proton-drive-rs/tests/live_transfer_ops.rs +++ b/crates/proton-drive-rs/tests/live_transfer_ops.rs @@ -260,8 +260,8 @@ async fn thumbnails_upload_and_fetch() { let thumb_small: Vec = (0..4096).map(|i| (i * 13 + 1) as u8).collect(); let thumb_preview: Vec = (0..8192).map(|i| (i * 17 + 3) as u8).collect(); let thumbnails = vec![ - Thumbnail::new(ThumbnailType::Thumbnail, thumb_small.clone()), - Thumbnail::new(ThumbnailType::Preview, thumb_preview.clone()), + Thumbnail::new(ThumbnailType::Thumbnail, thumb_small.clone()).unwrap(), + Thumbnail::new(ThumbnailType::Preview, thumb_preview.clone()).unwrap(), ]; let payload = b"file body for thumbnail upload".to_vec();