You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/08/27 07:55:39 UTC

(opendal) 02/03: fix(services/b2): preserve range in presigned reads

This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch xuanwo/fix-behavior-main-ci
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 5db45b0e63eca96cb12f9cf3d3c84fce7cd3ca3f
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Aug 27 15:55:02 2026 +0800

    fix(services/b2): preserve range in presigned reads
---
 core/services/b2/src/backend.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/services/b2/src/backend.rs b/core/services/b2/src/backend.rs
index 883c0b0c09..bf3047e062 100644
--- a/core/services/b2/src/backend.rs
+++ b/core/services/b2/src/backend.rs
@@ -393,7 +393,7 @@ impl Service for B2Backend {
                     parts.headers,
                 )))
             }
-            PresignOperation::Read(_, _) => {
+            PresignOperation::Read(range, _) => {
                 let resp = self
                     .core
                     .get_download_authorization(ctx, path, args.expire())
@@ -410,7 +410,10 @@ impl Service for B2Backend {
                     resp.authorization_token
                 );
 
-                let req = Request::get(url);
+                let mut req = Request::get(url);
+                if !range.is_full() {
+                    req = req.header(http::header::RANGE, range.to_header());
+                }
 
                 let req = req.body(Buffer::new()).map_err(new_request_build_error)?;