Fix EOF detection with CI artifacts metadata
There are some corner cases where a perfectly correct GZIP stream may not hit the EOF until another read is attempted. We now skip the entry if we don't see any valid data, which allows the EOF check to work properly. Closes https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22479
This commit is contained in:
parent
5edf87d0ac
commit
4c4d1b7928
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix EOF detection with CI artifacts metadata
|
||||
merge_request: 22479
|
||||
author:
|
||||
type: fixed
|
|
@ -59,9 +59,12 @@ module Gitlab
|
|||
|
||||
until gz.eof?
|
||||
begin
|
||||
path = read_string(gz).force_encoding('UTF-8')
|
||||
meta = read_string(gz).force_encoding('UTF-8')
|
||||
path = read_string(gz)&.force_encoding('UTF-8')
|
||||
meta = read_string(gz)&.force_encoding('UTF-8')
|
||||
|
||||
# We might hit an EOF while reading either value, so we should
|
||||
# abort if we don't get any data.
|
||||
next unless path && meta
|
||||
next unless path.valid_encoding? && meta.valid_encoding?
|
||||
next unless path =~ match_pattern
|
||||
next if path =~ INVALID_PATH_PATTERN
|
||||
|
|
Loading…
Reference in New Issue