phatina opened a new pull request, #8532:
URL: https://github.com/apache/opendal/pull/8532

   # Which issue does this PR close?
   
   Closes #8531.
   
   # Rationale for this change
   
   Google Drive returns no `size` for native Google files (Docs, Sheets, 
Slides) and for shortcuts. The gdrive lister already handles this by reporting 
those entries with an unknown mode. `stat`, `copy` and `rename`, however, 
require a size and fail with "gdrive stat/copy/move response does not contain 
file size".
   
   Because `CompleteLayer` calls `stat` on every entry whose mode is unknown, a 
folder with even one Google Doc in it cannot be listed. I hit this when listing 
a real Google Drive folder that contains a Google Doc.
   
   # What changes are included in this PR?
   
   - Moved `metadata_from_gdrive_file` from `lister.rs` to `core.rs` so that 
`stat`, `copy`, `rename` and `list` all build `Metadata` from a `GdriveFile` 
the same way. Folders map to `DIR`, files with a size map to `FILE` with a 
content length, and files without a size map to `Unknown`.
   - Replaced the separate metadata construction in `stat`, `copy` and 
`rename`, which treated a missing size as an error, with that helper.
   - Added unit tests for the helper covering a native Google file without a 
size, a regular file with a size, and a folder.
   
   # Are there any user-facing changes?
   
   Yes. `stat`, `copy` and `rename` now succeed on native Google files and 
return metadata with `EntryMode::Unknown` and no content length instead of an 
error. Listing a folder that contains such files no longer fails.
   
   # Breaking changes
   
   None.
   
   # AI Usage Statement
   
   - Harness: Claude Code
   - Model: Claude Opus 5.5 (claude-opus-5-5)
   - Effort: medium
   - Role: Identified the root cause, implemented the fix and its unit tests; I 
reproduced the failure against a real Google Drive account and reviewed the 
change myself. The unit tests use hand-built `GdriveFile` values, and the 
gdrive behavior tests were not run.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to