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

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

问题描述

我遇到了Google Drive SDK的一个奇怪问题 - 我不确定这是否是设计行为,或者它是否是范围界定中的错误。



<快速背景:我们正在开发一个使用drive.files范围的应用程序(例如,只有我们的应用程序创建的文件/文件夹),我们希望列出由我们的应用程序创建的所有文件夹。因此,我们使用drive.files.list方法调用(使用Javascript客户端API),查询驱动器文件夹mimeType:

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

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



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



这种行为可以重复使用Google API浏览器:


  1. 打开Goog​​le API浏览器: Google API资源管理器:带有空查询的drive.files.list

  2. 仅使用drive.file授权将OAuth权限设置为ON。
  3. >
  4. 用空查询单击执行。结果列表应该是空的。

  5. 现在,将文件夹查询输入到'q'参数框中:

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

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

我在这里错过了什么吗?这是预期的行为?如果是这样 - 是否有更好的方式来获取我们的应用程序创建的文件夹列表?

解决方案

感谢您的报告。该问题已得到解决,现在应按预期工作。


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.

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.

This behavior can be repeated using the Google APIs explorer:

  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'

  5. 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天全站免登陆