googlearchive / PyDrive

Google Drive API Python wrapper library
Other
1.31k stars 273 forks source link

not able to find 'shortcutDetails' as a metadata field on shortcut files #217

Closed SoundsSerious closed 3 years ago

SoundsSerious commented 3 years ago

This shortcut object doesn't have the shortcutDetails field you need to navigate to its target.

GoogleDriveFile({'id': '1YuGA0zu_cQkJgvSj2NY-wkqsqTDnadr4', 'kind': 'drive#file', 'etag': '"MTYxMTQ0NDQ4NzYxMQ"', 'selfLink': 
'https://www.googleapis.com/drive/v2/files/1YuGA0zu_cQkJgvSj2NY-wkqsqTDnadr4', 'alternateLink': 
'https://drive.google.com/file/d/1YuGA0zu_cQkJgvSj2NY-wkqsqTDnadr4/view?usp=drivesdk', 'embedLink': 
'https://drive.google.com/file/d/1YuGA0zu_cQkJgvSj2NY-wkqsqTDnadr4/preview?usp=drivesdk', 'iconLink': 'https://drive-
thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.shortcut', 'title': 'Neptunya', 'mimeType': 
'application/vnd.google-apps.shortcut', 'labels': {'starred': False, 'hidden': False, 'trashed': False, 'restricted': False, 'viewed': True, 
'modified': True}, 'copyRequiresWriterPermission': False, 'createdDate': '2021-01-23T23:27:51.576Z', 'modifiedDate': '2021-01-
23T23:28:07.611Z', 'modifiedByMeDate': '2021-01-23T23:28:07.611Z', 'lastViewedByMeDate': '2021-01-23T23:27:51.576Z', 
'markedViewedByMeDate': '1970-01-01T00:00:00.000Z', 'version': '3', 'parents': [{'kind': 'drive#parentReference', 'id': 
'1wRWjkRAzpbITi3uifR7XkiGMEnMiOxPk', 'selfLink': 'https://www.googleapis.com/drive/v2/files/1YuGA0zu_cQkJgvSj2NY-
wkqsqTDnadr4/parents/1wRWjkRAzpbITi3uifR7XkiGMEnMiOxPk', 'parentLink': 
'https://www.googleapis.com/drive/v2/files/1wRWjkRAzpbITi3uifR7XkiGMEnMiOxPk', 'isRoot': False}], 'userPermission': {'kind': 
'drive#permission', 'etag': '"hkW5zZX9bSCb-TVOMFL6Gqh9N_8"', 'id': 'me', 'selfLink': 
'https://www.googleapis.com/drive/v2/files/1YuGA0zu_cQkJgvSj2NY-wkqsqTDnadr4/permissions/me', 'role': 'owner', 'type': 
'user'}, 'quotaBytesUsed': '0', 'ownerNames': <removed>)
SoundsSerious commented 3 years ago

This object was received when calling shortcut_file.FetchMetadata(fetch_all=True)

SoundsSerious commented 3 years ago

I also tried hotpatching the _ALL_DATA fields with shortcutDetails however that didn't work

shcheklein commented 3 years ago

@SoundsSerious could you give PyDrive2 a try?

SoundsSerious commented 3 years ago

Ah actually just figured it out... figures as soon as I post the issue :/

I added shortcutDetails to the call in fields instead and that did the trick sht.FetchMetadata(fields='shortcutDetails')