OneDrive / onedrive-api-docs

Official documentation for the OneDrive API
MIT License
447 stars 228 forks source link

Error when downloading OneNote file with curl #1764

Open andylan1995 opened 7 months ago

andylan1995 commented 7 months ago

Category

Expected or Desired Behavior

Returns 200 and download the onenote file successfully.

Observed Behavior

Curl returns 52/56/92 when sending download requests for some onenote files. For one api, the curl operation returns 52 for HTTP1.1 protocal and return 56 or 92 for HTTP2. Below is one of the details of the api request/reponse. I have tried to request the metadata of that onenote file and the api behaved as expected, so it seems that the issue is only related to the download itself.

Steps to Reproduce

 curl -v --location --request GET 'https://<domain>-my.sharepoint.com/_api/v2.0/drives/b!4LYoALlZR0W5f0D3c6Y-N1I-We9ssDupURruwOp4qRYiL/items/016BPV4AXAIB4XD6E22RDJP6LZTV74BJOI/content' --header 'Authorization: Bearer <Bearer>'
Note: Unnecessary use of -X or --request, GET is already inferred.
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /_api/v2.0/drives/b!4LYoALlZR0W5f0D3c6Y-NbMDVEiBlYVJheLscM0s1I-We9ssDupURruwOp4qRYiL/items/016BPV4AXAIB4XD6E22RDJP6LZTV74BJOI/content HTTP/2
> Host: <domain>-my.sharepoint.com
> user-agent: curl/7.86.0
> accept: */*
> authorization: Bearer <Bearer>
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 302
< cache-control: no-cache, no-store
< pragma: no-cache
< content-type: application/octet-stream
< expires: -1
< location: https://<domain>-my.sharepoint.com/personal/kees_bin_<domain>_nl/_layouts/15/download.aspx?UniqueId=717940e0-9af8-46d4-97f9-799d7fc0a5c8&Translate=false&tempauth=<tempauth>&ApiVersion=2.0
< p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< x-networkstatistics: 0,525568,0,0,32331,0,26028
< x-sharepointhealthscore: 0
< x-sp-serverstate: ReadOnly=0
< odata-version: 4.0
< x-download-options: noopen
< content-disposition: attachment
< spclientservicerequestduration: 39
< sprequestduration: 39
< x-aspnet-version: 4.0.30319
< x-databoundary: EU
< x-1dscollectorurl: https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/
< x-ariacollectorurl: https://eu-mobile.events.data.microsoft.com/Collector/3.0
< sprequestguid: 3931f7a0-30e2-7000-ded7-61c3e4720ae3
< request-id: 3931f7a0-30e2-7000-ded7-61c3e4720ae3
< ms-cv: oPcxOeIwAHDe12HD5HIK4w.0
< strict-transport-security: max-age=31536000
< x-frame-options: SAMEORIGIN
< content-security-policy: frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com engage.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;
< x-powered-by: ASP.NET
< microsoftsharepointteamservices: 16.0.0.24329
< x-content-type-options: nosniff
< x-ms-invokeapp: 1; RequireReadOnly
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: 96F750EC294C4802B68AAB7AB04DCAA2 Ref B: TPE30EDGE0922 Ref C: 2023-12-13T01:59:45Z
< date: Wed, 13 Dec 2023 01:59:45 GMT
< content-length: 0
<
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /personal/kees_bin_<domain>_nl/_layouts/15/download.aspx?UniqueId=717940e0-9af8-46d4-97f9-799d7fc0a5c8&Translate=false&tempauth=<tempauth>&ApiVersion=2.0 HTTP/2
> Host: <domain>-my.sharepoint.com
> user-agent: curl/7.86.0
> accept: */*
> authorization: Bearer <Bearer>
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 302
< cache-control: private
< content-type: text/plain
< location: https://190162-ipv4v6.gr.global.aa-rt.sharepoint.com/personal/kees_bin_<domain>_nl/_layouts/15/download.aspx?UniqueId=717940e0-9af8-46d4-97f9-799d7fc0a5c8&Translate=false&siteHost=<domain>-my.sharepoint.com&tempauth=<tempauth>&ApiVersion=2.0
< p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< x-networkstatistics: 0,525568,0,0,32602,0,28715
< x-sharepointhealthscore: 3
< sprequestguid: 3931f7a0-c0f2-7000-ded7-624906a0a846
< request-id: 3931f7a0-c0f2-7000-ded7-624906a0a846
< ms-cv: oPcxOfLAAHDe12JJBqCoRg.0
< strict-transport-security: max-age=31536000
< x-aspnet-version: 4.0.30319
< sprequestduration: 26
< spiislatency: 1
< x-powered-by: ASP.NET
< microsoftsharepointteamservices: 16.0.0.24329
< x-content-type-options: nosniff
< x-ms-invokeapp: 1; RequireReadOnly
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: B9A10830E13A45EB8D973CB857A7DF60 Ref B: TPE30EDGE0922 Ref C: 2023-12-13T01:59:46Z
< date: Wed, 13 Dec 2023 01:59:46 GMT
< content-length: 0
<
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /personal/kees_bin_<domain>_nl/_layouts/15/download.aspx?UniqueId=717940e0-9af8-46d4-97f9-799d7fc0a5c8&Translate=false&siteHost=<domain>-my.sharepoint.com&tempauth=<tempauth>&ApiVersion=2.0 HTTP/1.1
> Host: 190162-ipv4v6.gr.global.aa-rt.sharepoint.com
> User-Agent: curl/7.86.0
> Accept: */*
>
* Empty reply from server
* TLSv1.2 (OUT), TLS header, Unknown (21):
* TLSv1.2 (OUT), TLS alert, close notify (256):
curl: (52) Empty reply from server

Thank you.