A problem when download JPG file using OneDrive api by curl

Copper Contributor

Hi Everyone,

Several JPG files can not be downloaded by OneDrive api. For these files, curl error code 18 occurs, and only download 12288 bytes for each OneDrive api on these files. I trued to download each "12288 bytes" seperately, but curl error code 52 occured in 3 sections: 3969024-3981311 (bytes) 3981312-3993599 (bytes) 3993600-4005887 (bytes)
Following is one of the result of OneDrive api by curl with curl error code 52.

Is it OneDrive api limitation such that some files could not be downloaded ?
Thanks for replies.
```

curl -v   --location --request GET 'https://<mydomain>-my.sharepoint.com/_api/v2.0/drives/b!-gmZGcdn7kK_NCXP5RA3ToaLICh24wpDtgwwIavsy26pi5tSGubzT6SAL1gKQK7Z/items/01NNZ5LBEEXEUYYRKCB5BZ7REMFYK35UXZ/content' -o output_file  --header "Authorization: Bearer <myBearer>"  --header "Range: bytes=3969024-3981311"

 

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.0 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.3 (OUT), TLS handshake, Client hello (1):

} [512 bytes data]

* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.3 (IN), TLS handshake, Server hello (2):

{ [98 bytes data]

* TLSv1.2 (IN), TLS handshake, Certificate (11):

{ [3773 bytes data]

* TLSv1.2 (IN), TLS handshake, Server key exchange (12):

{ [365 bytes data]

* TLSv1.2 (IN), TLS handshake, Server finished (14):

{ [4 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):

} [102 bytes data]

* TLSv1.2 (OUT), TLS header, Finished (20):

} [5 bytes data]

* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):

} [1 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Finished (20):

} [16 bytes data]

* TLSv1.2 (IN), TLS header, Finished (20):

{ [5 bytes data]

* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.2 (IN), TLS handshake, Finished (20):

{ [16 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

> GET  /_api/v2.0/drives/b!-gmZGcdn7kK_NCXP5RA3ToaLICh24wpDtgwwIavsy26pi5tSGubzT6SAL1gKQK7Z/items/01NNZ5LBEEXEUYYRKCB5BZ7REMFYK35UXZ/content HTTP/2

> Host: <mydomain>-my.sharepoint.com

> user-agent: curl/7.86.0

> accept: */*

> authorization: Bearer <accessToken>

> range: bytes=3969024-3981311

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

< HTTP/2 302

< cache-control: no-cache, no-store

< pragma: no-cache

< content-type: application/octet-stream

< expires: -1

< location: https://<mydomain>.sharepoint.com/sites/ReeseTowerServices/_layouts/15/download.aspx?UniqueId=8c29b984-4245-430f-9fc4-8c2e15bed2f9&Translate=false&tempauth=<tempaush>&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,2868,0,29725

< x-sharepointhealthscore: 1

< x-sp-serverstate: ReadOnly=0

< odata-version: 4.0

< x-download-options: noopen

< content-disposition: attachment

< spclientservicerequestduration: 28

< sprequestduration: 29

< x-aspnet-version: 4.0.30319

< x-databoundary: NONE

< x-1dscollectorurl: https://mobile.events.data.microsoft.com/OneCollector/1.0/

< x-ariacollectorurl: https://browser.pipe.aria.microsoft.com/Collector/3.0/

< sprequestguid: 530ef5a0-a02e-4000-846d-310c90ff58df

< request-id: 530ef5a0-a02e-4000-846d-310c90ff58df

< ms-cv: oPUOUy6gAECEbTEMkP9Y3w.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 *.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.24308

< x-content-type-options: nosniff

< x-ms-invokeapp: 1; RequireReadOnly

< x-cache: CONFIG_NOCACHE

< x-msedge-ref: Ref A: E80BE39E634E4577A8764275618E743B Ref B: TPE30EDGE0910 Ref C: 2023-12-06T10:41:58Z

< date: Wed, 06 Dec 2023 10:41:57 GMT

< content-length: 0

{ [0 bytes data]

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

* TLSv1.0 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.3 (OUT), TLS handshake, Client hello (1):

} [512 bytes data]

* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.3 (IN), TLS handshake, Server hello (2):

{ [98 bytes data]

* TLSv1.2 (IN), TLS handshake, Certificate (11):

{ [3773 bytes data]

* TLSv1.2 (IN), TLS handshake, Server key exchange (12):

{ [365 bytes data]

* TLSv1.2 (IN), TLS handshake, Server finished (14):

{ [4 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):

} [102 bytes data]

* TLSv1.2 (OUT), TLS header, Finished (20):

} [5 bytes data]

* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):

} [1 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Finished (20):

} [16 bytes data]

* TLSv1.2 (IN), TLS header, Finished (20):

{ [5 bytes data]

* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.2 (IN), TLS handshake, Finished (20):

{ [16 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

> GET  /sites/ReeseTowerServices/_layouts/15/download.aspx?UniqueId=8c29b984-4245-430f-9fc4-8c2e15bed2f9&Translate=false&tempauth=< tempauth>&ApiVersion=2.0 HTTP/2

> Host: <mydomain>.sharepoint.com

> user-agent: curl/7.86.0

> accept: */*

> range: bytes=3969024-3981311

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

* TLSv1.2 (IN), TLS header, Supplemental data (23):

{ [5 bytes data]

< HTTP/2 302

< cache-control: private

< content-type: text/plain

< location: https://191822-ipv4v6.gr.global.aa-rt.sharepoint.com/sites/ReeseTowerServices/_layouts/15/download.a...<mydomain>.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,594,0,24210

< x-sharepointhealthscore: 1

< sprequestguid: 530ef5a0-2071-4000-a662-7365bce63bdc

< request-id: 530ef5a0-2071-4000-a662-7365bce63bdc

< ms-cv: oPUOU3EgAECmYnNlvOY73A.0

< strict-transport-security: max-age=31536000

< x-aspnet-version: 4.0.30319

< sprequestduration: 20

< spiislatency: 1

< x-powered-by: ASP.NET

< microsoftsharepointteamservices: 16.0.0.24308

< x-content-type-options: nosniff

< x-ms-invokeapp: 1; RequireReadOnly

< x-cache: CONFIG_NOCACHE

< x-msedge-ref: Ref A: B9AC313255614F1B9D36295967754F3C Ref B: TPE30EDGE0709 Ref C: 2023-12-06T10:41:58Z

< date: Wed, 06 Dec 2023 10:41:59 GMT

< content-length: 0

{ [0 bytes data]

 

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

* TLSv1.0 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.3 (OUT), TLS handshake, Client hello (1):

} [512 bytes data]

 

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.3 (IN), TLS handshake, Server hello (2):

{ [85 bytes data]

* TLSv1.2 (IN), TLS handshake, Certificate (11):

{ [3057 bytes data]

* TLSv1.2 (IN), TLS handshake, Server key exchange (12):

{ [365 bytes data]

* TLSv1.2 (IN), TLS handshake, Server finished (14):

{ [4 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):

} [102 bytes data]

* TLSv1.2 (OUT), TLS header, Finished (20):

} [5 bytes data]

* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):

} [1 bytes data]

* TLSv1.2 (OUT), TLS header, Certificate Status (22):

} [5 bytes data]

* TLSv1.2 (OUT), TLS handshake, Finished (20):

} [16 bytes data]

* TLSv1.2 (IN), TLS header, Finished (20):

{ [5 bytes data]

* TLSv1.2 (IN), TLS header, Certificate Status (22):

{ [5 bytes data]

* TLSv1.2 (IN), TLS handshake, Finished (20):

{ [16 bytes data]

 

  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0* TLSv1.2 (OUT), TLS header, Supplemental data (23):

} [5 bytes data]

> GET  /sites/ReeseTowerServices/_layouts/15/download.aspx?UniqueId=8c29b984-4245-430f-9fc4-8c2e15bed2f9&Translate=false&siteHost=<mydomain>.sharepoint.com&tempauth=< tempauth>&ApiVersion=2.0 HTTP/1.1

> Host: 191822-ipv4v6.gr.global.aa-rt.sharepoint.com

> User-Agent: curl/7.86.0

> Accept: */*

> Range: bytes=3969024-3981311

* Empty reply from server

 

  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0

* TLSv1.2 (OUT), TLS header, Unknown (21):

} [5 bytes data]

* TLSv1.2 (OUT), TLS alert, close notify (256):

} [2 bytes data]

curl: (52) Empty reply from server```

0 Replies