summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-13 13:45:28 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:17 +0100
commit3f0c18f80e36561581ef6fa6dbfcec169e1a6e08 (patch)
tree96315bc7863ec3473dbac93594f78b0785c1429d
parenta9783c439bd6e3322b6fc72371c9fe3837a63be5 (diff)
downloadgitlab-ce-3f0c18f80e36561581ef6fa6dbfcec169e1a6e08.tar.gz
Simplify encoding related implementation in artifacts metadata
-rw-r--r--lib/gitlab/ci/build/artifacts/metadata.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/gitlab/ci/build/artifacts/metadata.rb b/lib/gitlab/ci/build/artifacts/metadata.rb
index 0c252c0bf30..e9ec8f1302c 100644
--- a/lib/gitlab/ci/build/artifacts/metadata.rb
+++ b/lib/gitlab/ci/build/artifacts/metadata.rb
@@ -10,8 +10,7 @@ module Gitlab
attr_reader :file, :path, :full_version
def initialize(file, path)
- @file = file
- @path = path.force_encoding('ASCII-8BIT')
+ @file, @path = file, path
@full_version = read_version
end
@@ -36,7 +35,7 @@ module Gitlab
end
def to_path
- Path.new(@path.dup.force_encoding('UTF-8'), *match!)
+ Path.new(@path, *match!)
end
private
@@ -48,11 +47,11 @@ module Gitlab
until gz.eof? do
begin
- path = read_string(gz)
- meta = read_string(gz)
+ path = read_string(gz).force_encoding('UTF-8')
+ meta = read_string(gz).force_encoding('UTF-8')
+ next unless path.valid_encoding? && meta.valid_encoding?
next unless path =~ match_pattern
- next unless path.force_encoding('UTF-8').valid_encoding?
next if path =~ invalid_pattern
paths.push(path)