anchor.diff:      end.
   
   
  -stream_chunks(Req0, BucketId, RealPrefix, ContentType, OrigName, Bytes, StartByte) ->
  +stream_chunks(Req0, BucketId, RealPrefix, ContentType, OrigName, Bytes, StartByte, EndByte) ->
       MaxKeys = ?FILE_MAXIMUM_SIZE div ?FILE_UPLOAD_CHUNK_SIZE,
  -    PartNum0 = (StartByte div ?FILE_UPLOAD_CHUNK_SIZE) + 1,
  +    PartNumStart = (StartByte div ?FILE_UPLOAD_CHUNK_SIZE) + 1,
  +    PartNumEnd =
  +	case EndByte of
  +	    infinity ->
  +		EB = utils:to_integer(Bytes),
  +		(EB div ?FILE_UPLOAD_CHUNK_SIZE) + 1;
  +	    _ -> (EndByte div ?FILE_UPLOAD_CHUNK_SIZE) + 1
  +	end,
       case riak_api:list_objects(BucketId, [{max_keys, MaxKeys}, {prefix, RealPrefix ++ "/"}]) of
   	not_found ->
   	    Req1 = cowboy_req:reply(404, #{
  
positive.code: 		 [PrefixedObjectKey | NextKeys] ->
  		    ContentDisposition = << <<"attachment;filename=\"">>/binary, OrigName/binary, <<"\"">>/binary >>,
  		    PartStartByte =
  			case PartNum0 of
  			    1 -> erlang:integer_to_binary(StartByte);
  			    _ -> erlang:integer_to_binary(StartByte rem ?FILE_UPLOAD_CHUNK_SIZE)
  			end,
  
negative.code: 		    {ok, Req1, []};
  		{OldBucketId, RealPrefix, ContentType, OrigName, Bytes} ->
  		    case validate_range(cowboy_req:header(<<"range">>, Req0), Bytes) of
  			undefined ->
  			    EndByte = utils:to_integer(Bytes),
  			    stream_chunks(Req0, OldBucketId, RealPrefix, ContentType, OrigName, Bytes, 0, EndByte);
  			{error, Number} -> js_handler:bad_request(Req0, Number);
  			{StartByte, EndByte} ->
  			    stream_chunks(Req0, OldBucketId, RealPrefix, ContentType, OrigName, Bytes, StartByte, EndByte)
  		    end
  	    end
      end.
  