Skip to content

Commit 32821b9

Browse files
committed
images: catch unicode errors
When the headers of the TarFile have non-utf8 encoded values (such is the case for some xattrs for file capabilities) (see http://ur1.ca/gzn2m), the repository fails to get pushed. Instead, just do not generate the tarsum for images with this failure. Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
1 parent ed76c35 commit 32821b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

registry/images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def put_image_layer(image_id):
193193
tarsum.append(member, tar)
194194
tarfilesinfo.append(member)
195195
layers.set_image_files_cache(image_id, tarfilesinfo.json())
196-
except (IOError, tarfile.TarError) as e:
196+
except (IOError, tarfile.TarError, UnicodeDecodeError) as e:
197197
logger.debug('put_image_layer: Error when reading Tar stream tarsum. '
198198
'Disabling TarSum, TarFilesInfo. Error: {0}'.format(e))
199199
finally:

0 commit comments

Comments
 (0)