Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Handle no Content-Length header downloads
Browse files Browse the repository at this point in the history
Before it would show Downloading: Infinity%, now it just shows Downloading...

I could reproduce this on the first time I download .zip source code from github releases page

Auditors: @aekeus
  • Loading branch information
bbondy committed Mar 31, 2016
1 parent f3c8fa7 commit eb96ff7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/locales/en-US/downloads.l20n
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<downloadCompleted "Completed">
<downloadInProgress "Downloading: {{$downloadPercent}}">
<downloadPaused "Paused: {{$downloadPercent}}">
<downloadInProgressUnknownTotal "Downloading...">

<downloadPause title: "Pause Download">
<downloadResume title: "Resume Download">
Expand Down
2 changes: 1 addition & 1 deletion js/components/downloadsBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DownloadItem extends ImmutableComponent {
}
</div>
{
this.isInProgress || this.isPaused
(this.isInProgress || this.isPaused) && this.props.download.get('totalBytes')
? <div className='downloadProgress' style={progressStyle}/>
: null
}
Expand Down
6 changes: 5 additions & 1 deletion js/state/downloadUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ module.exports.getL10nId = (download) => {
case downloadStates.CANCELLED:
return 'downloadCancelled'
case downloadStates.IN_PROGRESS:
return 'downloadInProgress'
if (!download.get('totalBytes')) {
return 'downloadInProgressUnknownTotal'
} else {
return 'downloadInProgress'
}
case downloadStates.COMPLETED:
return 'downloadCompleted'
case downloadStates.PAUSED:
Expand Down

1 comment on commit eb96ff7

@aekeus
Copy link
Member

@aekeus aekeus commented on eb96ff7 Mar 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ looks good

Please sign in to comment.