Commit 805cc5d6 authored by Shinya Maeda's avatar Shinya Maeda

Fix RegExp for dotenv report artifact

This commit fixes the regexp bug.
parent b4a3ed33
...@@ -54,7 +54,7 @@ module Ci ...@@ -54,7 +54,7 @@ module Ci
end end
def scan_line!(line) def scan_line!(line)
result = line.scan(/^(.*)=(.*)$/).last result = line.scan(/^(.*?)=(.*)$/).last
raise ParserError, 'Invalid Format' if result.nil? raise ParserError, 'Invalid Format' if result.nil?
......
---
title: Fix RegExp for dotenv report artifact
merge_request: 38562
author:
type: fixed
...@@ -66,12 +66,13 @@ RSpec.describe Ci::ParseDotenvArtifactService do ...@@ -66,12 +66,13 @@ RSpec.describe Ci::ParseDotenvArtifactService do
end end
context 'when multiple key/value pairs exist in one line' do context 'when multiple key/value pairs exist in one line' do
let(:blob) { 'KEY1=VAR1KEY2=VAR1' } let(:blob) { 'KEY=VARCONTAINING=EQLS' }
it 'returns error' do it 'parses the dotenv data' do
expect(subject[:status]).to eq(:error) subject
expect(subject[:message]).to eq("Validation failed: Key can contain only letters, digits and '_'.")
expect(subject[:http_status]).to eq(:bad_request) expect(build.job_variables.as_json).to contain_exactly(
hash_including('key' => 'KEY', 'value' => 'VARCONTAINING=EQLS'))
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment