Query: contains doesn't work with long prefix that end with 1
@vinay-google 已经在做这个了。
开始于 2023年2月2日。
评估
这个 Issue 还没有评估数据。
描述
Summary
When querying using name contains option, if the prefix ends with '1' it fails for all words above 19 characters.
Escaping the "\1" somehow fixes it (why though)
Excluding it by cutting the prefix short: works.
Using the full file name: works
Expected Behavior
- Get a list of files that have the prefix
Actual Behavior
- Returns empty list
Steps to Reproduce the Problem
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload
import io
scoped_creds = Credentials.from_service_account_info(creds, scopes=SCOPES)
gdrive = build("drive", "v3", credentials=scoped_creds)
parent_id = ""
data = io.BytesIO()
file_metadata = {
"name": "thistwentyletterword_20230122",
# "mimeType": "application/vnd.google-apps.spreadsheet",
"parents": ["parent_id"]
}
media = MediaIoBaseUpload(data, mimetype="text/csv", resumable=True)
# pylint: disable=maybe-no-member
print(
gdrive.files()
.create(
supportsAllDrives=True, body=file_metadata, media_body=media, fields="id"
)
.execute()
)
# -> {'id': 'long_generated_file_id'}
# search for file with 'thistwentyletterword_202301'
# adding more characters after the '1' fails as well as long as it's not the full file name.
print(
gdrive.files()
.list(
spaces="drive",
q=f"""\
mimeType != 'application/vnd.google-apps.folder'\
and name contains 'thistwentyletterword_202301'\
and trashed=false
""",
fields="files(id, name, mimeType)",
)
.execute()
.get("files")
)
# out-> []
# Escape the "\1"
print(
gdrive.files()
.list(
spaces="drive",
q=f"""\
mimeType != 'application/vnd.google-apps.folder'\
and name contains 'thistwentyletterword_20230\1'\
and trashed=false
""",
fields="files(id, name, mimeType)",
)
.execute()
.get("files")
)
# out-> [{'mimeType': 'text/csv', 'id': 'long_generated_file_id', 'name': 'thistwentyletterword_20230122'}]
Specifications
- Python version (
python --3.10.7) - OS (Mac/Linux/Windows)
- 主要语言
- Python
- 星标
- 1.4k
- 派生
- 917
- 平均合并
- 3 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleworkspace/python-samples 的其他 Issue
-
ايقاف البحث الأمن可能重新可做 @sqrrrl 于 400 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/python-samples#2434 · 已指派 1 人 ·
-
Slow Uploads using Google Drive API with Python可能重新可做 @sqrrrl 于 740 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/python-samples#1852 · 1 条评论 · 已指派 1 人 ·
-
403 error from google after a few successful runs of my code可能重新可做 @vinay-google 于 912 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/python-samples#1424 · 已指派 1 人 ·
-
How to see the progress of files which is getting uploaded可能重新可做 @vinay-google 于 928 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/python-samples#1404 · 已指派 1 人 ·
-
Phyton Samples可能重新可做 @PierrickVoulet 于 975 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/python-samples#1279 · 已指派 1 人 ·
查看 googleworkspace/python-samples 的全部 Issue
相似的 Issue
-
[Bug]: HTTP 499 (Client Closed Request) is classified as a non-retryable format_error, so a mid-flight abort fails the turn over instead of retrying可能已有人在做 @yipinghuang1991 今天认领。 未关闭comp/agent P2 type/bug
难度 2/5 1-3 小时 新手友好度 82/100
NousResearch/hermes-agent#156837 ·
维护者通常 1 天内回复
-
Bug: Missing continue on ValueError in CpanBackend.check_feed causes UnboundLocalError or duplicate yields可能已有人在做 @muskan-creates352 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 86/100
fedora-infra/anitya#2188 ·
维护者通常 1 天内回复
-
docs documentation need-triage SaaS
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
integration:hermes
难度 2/5 1-3 小时 新手友好度 85/100
vectorize-io/hindsight#6601 ·
维护者通常 1 天内回复
-
triage:product type:bug
难度 2/5 1-3 小时 新手友好度 76/100
dbt-labs/dbt-adapters#2333 ·
维护者通常 1 天内回复