phatina opened a new issue, #8531:
URL: https://github.com/apache/opendal/issues/8531
### OpenDAL version or commit
main (6bd12994), also present in 0.59.4 and 0.59.5
### Affected service or component
services/gdrive
### Describe the bug
Google Drive returns no `size` field for native Google files (Docs, Sheets,
Slides) and for shortcuts. The gdrive lister already handles this and reports
those entries with `EntryMode::Unknown`. `stat`, `copy` and `rename`, however,
treat a missing size as an error:
```
Unexpected: gdrive stat response does not contain file size
Unexpected: gdrive copy response does not contain file size
Unexpected: gdrive move response does not contain file size
```
`CompleteLayer` calls `stat` on every listed entry whose mode is unknown, so
this also breaks listing. A folder that contains even one Google Doc cannot be
listed.
### Steps to Reproduce
1. In Google Drive, create a folder that contains a Google Doc (or a Sheet,
Slides file or shortcut).
2. Configure an `Operator` with the gdrive service.
3. Call `op.list("folder/")`, or `op.stat("folder/<google doc>")`.
### Actual Behavior
`list` and `stat` fail with `Unexpected: gdrive stat response does not
contain file size`. `copy` and `rename` of native Google files fail with the
matching copy or move error.
### Expected Behavior
The list succeeds. `stat` returns metadata for the native file with an
unknown mode and no content length, the same way the lister reports it. `copy`
and `rename` of such files also succeed.
### Additional Context
`core/services/gdrive/src/backend.rs` builds `Metadata` itself in `stat`,
`copy` and `rename` and requires `size` for anything that isn't a folder.
`lister.rs` has its own `metadata_from_gdrive_file`, which falls back to
`MetadataBuilder::unknown()` when there is no size.
### Reproduction confirmation
- [x] I reproduced this issue against the affected component. For a
service-specific report, I used the actual service rather than only a mock,
emulator, or source-code analysis.
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
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]