Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drive List returns list of files from trash #2199

Open
addiercv opened this issue Jul 20, 2023 · 1 comment
Open

Drive List returns list of files from trash #2199

addiercv opened this issue Jul 20, 2023 · 1 comment
Assignees
Labels
api: drive Issues related to the Drive API API. external This issue is blocked on a bug with the actual product. type: question Request for information or clarification. Not an issue.

Comments

@addiercv
Copy link

addiercv commented Jul 20, 2023

While trying to list image files in a google drive folder using v3 api:

  1. When drive folder is empty, it works fine and return None
  2. When there is an existing image in the folder, api starts to return images from the trash

For a desktop app using Python, following code is used to list files. The behavior remains same even when trashed is used instead of explicitlyTrashed.

q = "'{}' in parents and explicitlyTrashed=false and mimeType='image/png'".format(folder_id) 
files = service.files().list(q=q, 
                                      spaces='drive',
                                      fields='nextPageToken, '
                                          'files(id, name)',
                                      pageToken=page_token).execute() 
@parthea parthea self-assigned this Jul 24, 2023
@parthea parthea added api: drive Issues related to the Drive API API. type: question Request for information or clarification. Not an issue. labels Jul 24, 2023
@parthea
Copy link
Contributor

parthea commented Jul 24, 2023

Hello @addiercv,

See related issue in the issue tracker for Google Drive API here which states the API will return items from trash by default.
https://issuetracker.google.com/issues/135861184

There is also a note in the reference documentation for files.list which states

Note: This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false query parameter to remove trashed files from the results.

I see that you mentioned that you included trashed=false in your API request and you still received trashed items.

Please could you try out a similar request in the Try this method interface on this page and check whether the issue still exists? This helps to confirm if this is a client library issue or a API issue. If this is an issue with the API itself, we'll redirect you to the API support channel so you can get better quality answers. For the Drive API please see https://developers.google.com/drive/api/support#developer_product_feedback

@parthea parthea added the external This issue is blocked on a bug with the actual product. label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: drive Issues related to the Drive API API. external This issue is blocked on a bug with the actual product. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants