Repository navigation
Reject Drive API v2 field names instead of dropping them - #425
Draft
shcheklein wants to merge 3 commits into
Draft
shcheklein wants to merge 3 commits into
shcheklein wants to merge 3 commits into
Conversation
A temporary live test. It uploads, shares and lists with v2 names such as title and modifiedDate, and fails with a report of what Drive returned. The fix that follows replaces it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The first run showed that Drive accepts {"parents": [{"id": ...}]} without
an error. This run records where such a file is placed.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Drive v3 ignores fields it does not know. A file uploaded with title is named "Untitled", one uploaded with parent objects lands in the root of My Drive, and a list of properties is stored under the wrong keys. Upload() and InsertPermission() now raise for these v2 forms before they send anything. This also removes the temporary probe test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A program written for PyDrive2 1.x names a file with
titleand places it with a parent object:In 2.0 this upload succeeds and creates a file named "Untitled" in the root of My Drive. Drive API v3 ignores every field it does not know, and the local object still returns
file["title"].What Drive v3 does with v2 metadata
The first two commits are a temporary live test that sent v2 forms to Drive and printed the result (first run, second run).
titleon createtitleon updatecreatedDate,modifiedDate,lastViewedByMeDate,labels,indexableTextparents: [{"id": folder}]on createparents: [{"id": folder}]on updatepropertiesas a list of{key, value, visibility}key,valueandvisibilitywithLink,additionalRolesvalueemailAddressis requiredtitleinqororderByChanges
Upload()raisesValueErrorfor a renamed v2 file field and names the v3 field:title,createdDate,modifiedDate,lastViewedByMeDate,labels,indexableText,thumbnail.Upload()raisesTypeErrorfor parent objects and for a list ofproperties.InsertPermission()raisesValueErrorforvalue,withLink,additionalRolesandexpirationDate.Reads and queries are unchanged.
file["title"], andtitleinqororderBy, already fail with an error.Validation
FileorPermissionschema.expirationDatewas not sent to Drive, because that needs a real user to share with. It is rejected on the strength of the other permission fields being ignored.🤖 Generated with Claude Code