当我们尝试使用Google Drive API从Google Photo下载扩展名为.mp4
的文件时,the downloaded file always has different md5
哈希值与远程元数据提供的md5Checksum字段。
例如,假设Google Photo上存在文件名video.mp4。我们使用以下任一URL下载文件后:
(v2) https://doc-14-6c-docs.googleusercontent.com/docs/securesc/[SOME_VALUES]?h=[SOME_VALUES]&e=download&gd=true
(v3) https://www.googleapis.com/drive/v3/files/[FILEID]?alt=media
这两种方法都会在本地计算机上正确下载文件。文件大小也与远程元数据的fileSize字段相同。
但是,md5哈希值与远程元数据的md5Checksum字段不一致。例如,如果我们输入$ md5sum video.mp4命令,我们可能会得到5cf9fb1bb88dc9bf38d1de5c9180dc4e video.mp4
。这不是远程元数据记录的哈希值。
除扩展名为.mp4
的文件外,所有其他文件都可以正常工作(大小和哈希值一致)。顺便说一下,我们使用CURL向Google Drive API发送请求以下载这些文件,而不是使用任何Google Drive SDK。
希望有人可以帮助我们,谢谢!
[更新]更多解释
这些文件来自我们客户的Google Photo。我们不知道重现这种情况的确切方法。我们提供有问题的文件之一的元数据供您参考。 (我们删除了一些私人信息。)
{
"kind": "drive#file",
"id": "(REMOVED)",
"etag": "(REMOVED)",
"selfLink": "(REMOVED)",
"webContentLink": "(REMOVED)",
"alternateLink": "(REMOVED)",
"embedLink": "(REMOVED)",
"iconLink": "(REMOVED)",
"thumbnailLink": "(REMOVED)",
"title": "(REMOVED)",
"mimeType": "video/mp4",
"description": "",
"labels": {
"starred": false,
"hidden": false,
"trashed": false,
"restricted": false,
"viewed": false
},
"createdDate": "2016-10-10T11:42:25.000Z",
"modifiedDate": "2016-10-18T23:01:19.000Z",
"modifiedByMeDate": "2016-10-18T23:01:19.000Z",
"markedViewedByMeDate": "1970-01-01T00:00:00.000Z",
"version": "133589",
"parents": [
{
"kind": "drive#parentReference",
"id": "(REMOVED)",
"selfLink": "(REMOVED)",
"parentLink": "(REMOVED)",
"isRoot": false
}
],
"downloadUrl": "(REMOVED)",
"userPermission": {
"kind": "drive#permission",
"etag": "(REMOVED)",
"id": "me",
"selfLink": "(REMOVED)",
"role": "owner",
"type": "user"
},
"originalFilename": "(REMOVED)",
"fileExtension": "mp4",
"md5Checksum": "c5a208198614c34b6fc61186d025df77",
"fileSize": "15284923",
"quotaBytesUsed": "0",
"ownerNames": [
"(REMOVED)"
],
"owners": [
{
"kind": "drive#user",
"displayName": "(REMOVED)",
"picture": {
"url": "(REMOVED)"
},
"isAuthenticatedUser": true,
"permissionId": "(REMOVED)",
"emailAddress": "(REMOVED)"
}
],
"lastModifyingUserName": "(REMOVED)",
"lastModifyingUser": {
"kind": "drive#user",
"displayName": "(REMOVED)",
"picture": {
"url": "(REMOVED)"
},
"isAuthenticatedUser": true,
"permissionId": "(REMOVED)",
"emailAddress": "(REMOVED)"
},
"capabilities": {
"canCopy": true,
"canEdit": true
},
"editable": true,
"copyable": true,
"writersCanShare": true,
"shared": false,
"explicitlyTrashed": false,
"appDataContents": false,
"headRevisionId": "(REMOVED)",
"videoMediaMetadata": {
"width": 720,
"height": 1280,
"durationMillis": "43697"
},
"spaces": [
"photos",
"drive"
]}
如您所见,md5Checksum
字段在元数据中显示c5a208198614c34b6fc61186d025df77
。但是,实际的md5哈希值会等于95be52d721e2f5d8d02650b27095d466
。