Fix dockerfile parsing for unicode
This commit is contained in:
parent
3a935822fc
commit
9aa62bd92b
1 changed files with 4 additions and 3 deletions
|
@ -79,8 +79,8 @@ def parse_dockerfile(contents):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
match_command = COMMAND_REGEX.match(line)
|
match_command = COMMAND_REGEX.match(line)
|
||||||
if match_command:
|
if match_command:
|
||||||
command = match_command.group(1).upper()
|
command = match_command.group(1).decode('utf-8').upper()
|
||||||
parameters = match_command.group(2)
|
parameters = match_command.group(2).decode('utf-8')
|
||||||
|
|
||||||
commands.append({
|
commands.append({
|
||||||
'command': command,
|
'command': command,
|
||||||
|
@ -91,5 +91,6 @@ def parse_dockerfile(contents):
|
||||||
|
|
||||||
|
|
||||||
def serialize_dockerfile(parsed_dockerfile):
|
def serialize_dockerfile(parsed_dockerfile):
|
||||||
return '\n'.join([' '.join([command['command'], command['parameters']])
|
return '\n'.join([' '.join([command['command'].encode('utf-8'),
|
||||||
|
command['parameters'].encode('utf-8')])
|
||||||
for command in parsed_dockerfile.commands])
|
for command in parsed_dockerfile.commands])
|
||||||
|
|
Reference in a new issue