projects
/
pithos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
533be0b
)
Calculate the length of the last block properly.
author
Antony Chazapis
<chazapis@gmail.com>
Thu, 19 Apr 2012 16:02:09 +0000
(19:02 +0300)
committer
Antony Chazapis
<chazapis@gmail.com>
Thu, 19 Apr 2012 16:02:09 +0000
(19:02 +0300)
Fixes #2321
snf-pithos-app/pithos/api/util.py
patch
|
blob
|
history
diff --git
a/snf-pithos-app/pithos/api/util.py
b/snf-pithos-app/pithos/api/util.py
index
4c4513c
..
7481ac3
100644
(file)
--- a/
snf-pithos-app/pithos/api/util.py
+++ b/
snf-pithos-app/pithos/api/util.py
@@
-661,7
+661,8
@@
class ObjectWrapper(object):
# Get the data from the block.
bo = self.offset % self.backend.block_size
bs = self.backend.block_size
- if self.block_index == len(self.hashmaps[self.file_index]) - 1:
+ if (self.block_index == len(self.hashmaps[self.file_index]) - 1 and
+ self.sizes[self.file_index] % self.backend.block_size):
bs = self.sizes[self.file_index] % self.backend.block_size
bl = min(self.length, bs - bo)
data = self.block[bo:bo + bl]