When attempting to download a publicly shared zip file from Google Drive, you may encounter an issue where a blank "file.zip" is created instead. This is due to a potential bug involving either Google Drive or Go.
The root of the problem lies in the fact that the initial download URL provided by Google Drive redirects to a second URL containing an asterisk (*) character as a delimiter. However, when Go attempts to fetch this URL, it encodes the asterisk as *, changing the URL to:
https://doc-00-c8-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/8i67l6m6cdojptjuh883mu0qqmtptds1/1376330400000/06448503420061938118/%2A/0B2Q7X-dUtUBebElySVh1ZS1iaTQ?h=16653014193614665626&e=download
Unfortunately, Google responds with "403 Forbidden" to this encoded URL, suggesting that the * encoding is not being successfully interpreted as an asterisk.
To resolve this issue:
https://doc-00-c8-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/8i67l6m6cdojptjuh883mu0qqmtptds1/1376330400000/06448503420061938118/*/0B2Q7X-dUtUBebElySVh1ZS1iaTQ?h=16653014193614665626&e=download
https://doc-00-c8-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/8i67l6m6cdojptjuh883mu0qqmtptds1/1376330400000/06448503420061938118/%2A/0B2Q7X-dUtUBebElySVh1ZS1iaTQ?h=16653014193614665626&e=download
The above is the detailed content of Why does my Go program download an empty zip file when I try to download a public file from Google Drive?. For more information, please follow other related articles on the PHP Chinese website!