Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 6a6a3e1

Browse files
committed
Merge pull request #379 from dotcloud/#248
Fix #248
2 parents 42244e0 + 5a51804 commit 6a6a3e1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docker_registry/lib/layers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Archive(lzma.LZMAFile):
4949
This class wraps a file-object that contains tar archive data. The data
5050
will be optionally decompressed with lzma/xz if found to be a compressed
5151
archive.
52+
The file-object itself must be seekable.
5253
"""
5354

5455
def __init__(self, *args, **kwargs):
@@ -59,9 +60,11 @@ def _proxy(self, method, *args, **kwargs):
5960
if not self.compressed:
6061
return getattr(self._fp, method)(*args, **kwargs)
6162
if self.compressed:
63+
previous = self._fp.tell()
6264
try:
6365
return getattr(super(Archive, self), method)(*args, **kwargs)
6466
except lzma._lzma.LZMAError:
67+
self._fp.seek(previous)
6568
self.compressed = False
6669
return getattr(self._fp, method)(*args, **kwargs)
6770

0 commit comments

Comments
 (0)