Open richardgroves opened 1 year ago
File download progress block can be called with a negative progress value
Download a file from a server where the content length is not known/knowable
-22424 passed as progress of download when 243 bytes had been downloaded.
0 passed as progress if true value not knowable?
Parse Core 1.19.4, but same code problem exists in 2.02
Client
1.19.4
Server
NA
iOS 16.2
Remote - Back4App
Database
Mongo
3.0
Narrative version:
It is possible to have a download progress block called with a negative progress value.
This occurs as the line:
https://github.com/parse-community/Parse-SDK-iOS-OSX/blob/b6ec05c8ea17d936cb695713d11e0a61854bfe84/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionFileDownloadTaskDelegate.m#L62
does not include a check for self.response.expectedContentLength == NSURLResponseUnknownLength (NSURLResponseUnknownLength = -1).
self.response.expectedContentLength == NSURLResponseUnknownLength
New Issue Checklist
Issue Description
File download progress block can be called with a negative progress value
Steps to reproduce
Download a file from a server where the content length is not known/knowable
Actual Outcome
-22424 passed as progress of download when 243 bytes had been downloaded.
Expected Outcome
0 passed as progress if true value not knowable?
Environment
Parse Core 1.19.4, but same code problem exists in 2.02
Client
1.19.4
& all others up to 2.0.2Server
NA
iOS 16.2
Remote - Back4App
Database
Mongo
3.0
Remote - Back4App
Logs
NA
Narrative version:
It is possible to have a download progress block called with a negative progress value.
This occurs as the line:
https://github.com/parse-community/Parse-SDK-iOS-OSX/blob/b6ec05c8ea17d936cb695713d11e0a61854bfe84/Parse/Parse/Internal/Commands/CommandRunner/URLSession/Session/TaskDelegate/PFURLSessionFileDownloadTaskDelegate.m#L62
does not include a check for
self.response.expectedContentLength == NSURLResponseUnknownLength
(NSURLResponseUnknownLength = -1).