Skip to content

Commit

Permalink
Resolve Key not found: nextExpectedRanges (Issue #408) (#409)
Browse files Browse the repository at this point in the history
* Dont 'assume' that the key value pairs exist. Check if they do before attempting to use them
  • Loading branch information
abraunegg authored Mar 12, 2019
1 parent 9862426 commit e849eb3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/upload.d
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ struct UploadSession

JSONValue upload()
{
long offset = session["nextExpectedRanges"][0].str.splitter('-').front.to!long;
long fileSize = getSize(session["localPath"].str);
long offset;
long fileSize;

if ("nextExpectedRanges" in session){
offset = session["nextExpectedRanges"][0].str.splitter('-').front.to!long;
}

if ("localPath" in session){
fileSize = getSize(session["localPath"].str);
}

// Upload Progress Bar
size_t iteration = (roundTo!int(double(fileSize)/double(fragmentSize)))+1;
Expand Down

0 comments on commit e849eb3

Please sign in to comment.