使用搜索查询列出文件会返回超出范围的结果(drive.files.list 调用,使用 drive.files 范围) [英] Listing files with search query returns out-of-scope results (drive.files.list call, using drive.files scope)

查看:18
本文介绍了使用搜索查询列出文件会返回超出范围的结果(drive.files.list 调用,使用 drive.files 范围)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Google Drive SDK 时遇到了一个奇怪的问题——我不确定这是设计行为还是范围界定中的错误.

I'm running into a strange issue with the Google Drive SDK — I'm not sure if this is the designed behavior or if it's a bug in the scoping.

快速背景:我们正在使用drive.files"范围开发应用程序(例如,仅由我们的应用程序创建的文件/文件夹)并且我们想要列出由我们的应用程序创建的所有文件夹.所以我们使用 drive.files.list 方法调用(使用 Javascript 客户端 API),查询驱动器文件夹 mimeType:

Quick background: we're developing an application using the "drive.files" scope (e.g. only files / folders created by our app) and we want to list all folders created by our app. So we use the drive.files.list method call (using the Javascript client API), with a query for the drive folder mimeType:

mimeType = 'application/vnd.google-apps.folder'

问题:返回的是用户云端硬盘帐户中所有文件夹的列表,而不仅仅是我们的应用创建的文件夹.

The problem: what comes back is a list of all folders in the user's Drive account, not just the ones created by our app.

这不是公然违反范围吗?据我所知,文档并没有说明我们是否应该看到搜索查询返回的超出范围的文件.

Is this not a blatant violation of scope? As far as I can tell, the documentation doesn't indicate whether we should expect to see out-of-scope files returned from search queries.

可以使用 Google API 资源管理器重复此行为:

This behavior can be repeated using the Google APIs explorer:

  1. 打开 Google API 资源管理器:Google API 资源管理器:带有空查询的 drive.files.list
  2. 将 OAuth 授权设为 ON,仅使用 drive.file 授权.
  3. 点击执行",查询为空.结果列表应为空.
  4. 现在,在q"参数框中输入文件夹查询:

  1. Open the Google APIs explorer: Google APIs Explorer: drive.files.list with empty query
  2. Turn OAuth authorization to ON, using only the drive.file authorization.
  3. Click "Execute" with an empty query. The results list should be empty.
  4. Now, enter the folder query into the 'q' parameter box:

mimeType = 'application/vnd.google-apps.folder'

mimeType = 'application/vnd.google-apps.folder'

点击执行".结果列表显示用户云端硬盘帐户中由 API Explorer 应用创建的文件夹.

Click "Execute". The results list shows folders in the users' Drive account that have not been created by the APIs Explorer app.

我在这里遗漏了什么吗?这是预期的行为吗?如果是这样 - 有没有更好的方法来获取仅由我们的应用创建的文件夹列表?

Am I missing something here? Is this the expected behavior? And if so — is there a better way to get the list of folders only created by our app?

推荐答案

感谢您的报告.该问题已得到修复,现在应该可以正常工作了.

Thanks for the report. The issue has been fixed and should work as expected now.

这篇关于使用搜索查询列出文件会返回超出范围的结果(drive.files.list 调用,使用 drive.files 范围)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆