dosubot[bot] commented on issue #7057:
URL: https://github.com/apache/opendal/issues/7057#issuecomment-3667430694

   <!-- Greeting -->
   Hi @mro68! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
opendal team.
   
   <!-- Answer -->
   You're right on target with your diagnosis and proposed fix. The root cause 
is that the Google Drive backend's `list()` operation doesn't request the 
`size` and `modifiedTime` fields from the API, nor does it map them into the 
returned metadata, even though `stat()` does this correctly. This leads to all 
listed files reporting `content_length = 0`, which breaks backup, sync, and 
integrity tools.
   
   Recent work in [PR #6683](https://github.com/apache/opendal/pull/6683) added 
the `fields` parameter to Google Drive API calls, including `size` and 
`modifiedTime`, which aligns with your suggested fix. However, there are still 
some follow-up issues being tracked 
([#6684](https://github.com/apache/opendal/issues/6684)) regarding metadata 
handling and optional fields, so it's possible the mapping in the lister still 
needs to be updated to match the `stat()` implementation.
   
   To fully resolve the issue, make sure:
   - The `fields` parameter in the list API call includes `size` and 
`modifiedTime`.
   - The lister maps these fields into the `Metadata` object for each entry, 
just like in `stat()`.
   - The `GdriveFile` struct includes these fields as optional, to handle cases 
where they may be missing.
   
   Your test case is a great way to verify the fix. Once these changes are in 
place, `list()` should return the correct file sizes and metadata, restoring 
expected behavior for all downstream tools.
   
   If you want to double-check the current state, review the latest code in 
`core/src/services/gdrive/core.rs` and `lister.rs` to ensure the mapping is 
complete and matches the working `stat()` logic. If not, applying your patch 
should resolve the bug. 
   
   Let me know if you want a code snippet for the mapping logic or have any 
other questions!
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=hallucination)
 | [Report 
šŸ›](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/b523257e-3a95-4c4c-ae19-a93e841a03a2?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/997a2c5a-0c54-497b-989d-44651635dd36/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%27re%20right%20on%20target%20with%20your%20diagnosis%20and%20proposed%20fix.%20The%20root%20cause%20is%20that%20the%20Google%20Drive%20backend%27s%20%60list%28%29%60%20operation%20doesn%27t%20request%20the%20%60size%60%20and%20%60modifiedTime%60%20fields%20from%20the%20API%2C%20nor%20does%20it%20map%20them%20into%20the%20returned%20metadata%2C%20even%20though%20%60stat%28%29%60%20does%20this%20correctly.%20This%20leads%20to%20all%20listed%20files%20reporting%20%60content_length%20%3D%200%60%2C%20which%20breaks%20backup%2C%20sync%2C%20and%20integrity%20tools.%0A%0ARecent%20work%20in%20%5BPR%20%236683%5D%28https%3A//github.com/apache/opendal/pull/6683%29%20added%20the%20%60fields%60%20parameter%20to%20Google%20Drive%20API%20calls%2C%20including%2
 
0%60size%60%20and%20%60modifiedTime%60%2C%20which%20aligns%20with%20your%20suggested%20fix.%20However%2C%20there%20are%20still%20some%20follow-up%20issues%20being%20tracked%20%28%5B%236684%5D%28https%3A//github.com/apache/opendal/issues/6684%29%29%20regarding%20metadata%20handling%20and%20optional%20fields%2C%20so%20it%27s%20possible%20the%20mapping%20in%20the%20lister%20still%20needs%20to%20be%20updated%20to%20match%20the%20%60stat%28%29%60%20implementation.%0A%0ATo%20fully%20resolve%20the%20issue%2C%20make%20sure%3A%0A-%20The%20%60fields%60%20parameter%20in%20the%20list%20API%20call%20includes%20%60size%60%20and%20%60modifiedTime%60.%0A-%20The%20lister%20maps%20these%20fields%20into%20the%20%60Metadata%60%20object%20for%20each%20entry%2C%20just%20like%20in%20%60stat%28%29%60.%0A-%20The%20%60GdriveFile%60%20struct%20includes%20these%20fields%20as%20optional%2C%20to%20handle%20cases%20where%20they%20may%20be%20missing.%0A%0AYour%20test%20case%20is%20a%20great%20way%20to%20verify%20t
 
he%20fix.%20Once%20these%20changes%20are%20in%20place%2C%20%60list%28%29%60%20should%20return%20the%20correct%20file%20sizes%20and%20metadata%2C%20restoring%20expected%20behavior%20for%20all%20downstream%20tools.%0A%0AIf%20you%20want%20to%20double-check%20the%20current%20state%2C%20review%20the%20latest%20code%20in%20%60core/src/services/gdrive/core.rs%60%20and%20%60lister.rs%60%20to%20ensure%20the%20mapping%20is%20complete%20and%20matches%20the%20working%20%60stat%28%29%60%20logic.%20If%20not%2C%20applying%20your%20patch%20should%20resolve%20the%20bug.%20%0A%0ALet%20me%20know%20if%20you%20want%20a%20code%20snippet%20for%20the%20mapping%20logic%20or%20have%20any%20other%20questions%21)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//gi
 thub.com/apache/opendal/issues/7057)


-- 
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