Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative progress value on file download #1705

Open
richardgroves opened this issue Feb 10, 2023 · 1 comment
Open

Negative progress value on file download #1705

richardgroves opened this issue Feb 10, 2023 · 1 comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@richardgroves
Copy link
Contributor

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

  • Parse ObjC SDK version: 1.19.4 & all others up to 2.0.2

Server

  • Parse Server version: NA
  • Operating system: iOS 16.2
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Remote - Back4App

Database

  • System (MongoDB or Postgres): Mongo
  • Database version: 3.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): 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:

int progress = (int)(self.downloadedBytes / (double)self.response.expectedContentLength * 100);

does not include a check for self.response.expectedContentLength == NSURLResponseUnknownLength
(NSURLResponseUnknownLength = -1).

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants