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

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


The following commit(s) were added to refs/heads/main by this push:
     new 334665894 feat(services/huggingface): Enrich metadata with ETag and 
security scan flags (#6834)
334665894 is described below

commit 334665894c1578c66dd1e85a2093467718ea97ac
Author: Aryan Bagade <[email protected]>
AuthorDate: Sat Nov 29 04:52:40 2025 -0800

    feat(services/huggingface): Enrich metadata with ETag and security scan 
flags (#6834)
    
    * feat(services/huggingface): Enrich metadata with ETag and security scan 
flags
    
    Enrich file metadata by surfacing OID as ETag and exposing security scan 
information via user metadata.
    
    * Keep only ETag support
---
 core/src/services/huggingface/backend.rs | 8 ++++++++
 core/src/services/huggingface/lister.rs  | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/core/src/services/huggingface/backend.rs 
b/core/src/services/huggingface/backend.rs
index 7bfe9e068..d7236dc95 100644
--- a/core/src/services/huggingface/backend.rs
+++ b/core/src/services/huggingface/backend.rs
@@ -242,6 +242,14 @@ impl Access for HuggingfaceBackend {
 
                     meta.set_content_length(status.size);
 
+                    // Use LFS OID as ETag if available, otherwise use regular 
OID
+                    let etag = if let Some(lfs) = &status.lfs {
+                        &lfs.oid
+                    } else {
+                        &status.oid
+                    };
+                    meta.set_etag(etag);
+
                     match status.type_.as_str() {
                         "directory" => meta.set_mode(EntryMode::DIR),
                         "file" => meta.set_mode(EntryMode::FILE),
diff --git a/core/src/services/huggingface/lister.rs 
b/core/src/services/huggingface/lister.rs
index 83a60f79c..a544e05da 100644
--- a/core/src/services/huggingface/lister.rs
+++ b/core/src/services/huggingface/lister.rs
@@ -85,6 +85,14 @@ impl oio::PageList for HuggingfaceLister {
 
             if entry_type == EntryMode::FILE {
                 meta.set_content_length(status.size);
+
+                // Use LFS OID as ETag if available, otherwise use regular OID
+                let etag = if let Some(lfs) = &status.lfs {
+                    &lfs.oid
+                } else {
+                    &status.oid
+                };
+                meta.set_etag(etag);
             }
 
             let path = if entry_type == EntryMode::DIR {

Reply via email to