Fix RequestEntityTooLarge exception from read func

The RequestEntityTooLarge that are thrown from
read function (common/utils.py) will include
only the limit parameter. The param that
indicated the number of blob's bytes was
removed.
we cannot be sure that we will have
the number of bytes of the user's blob.

Change-Id: I57a586dae413519238acfd826dcb6316732f8e43
This commit is contained in:
Idan 2017-06-27 15:15:00 +00:00 committed by Idan Narotzki
parent e228d9eff9
commit 4d31dd29f7
1 changed files with 3 additions and 5 deletions

View File

@ -200,11 +200,9 @@ class LimitingReader(object):
self.sha1.update(res)
self.sha256.update(res)
if self.bytes_read > self.limit:
message = (_("The server is refusing to process a request because"
" the request entity with size of %(blob_length)s"
" bytes, is larger than the server is willing or able"
" to process - %(limit)s bytes.") %
{"blob_length": len_result, "limit": self.limit})
message = _("The server is refusing to process a request because"
" the request entity is larger than the server is"
" willing or able to process - %s bytes.") % self.limit
raise exception.RequestEntityTooLarge(message=message)
return res