Fix dockerfile parsing for unicode

This commit is contained in:
Joseph Schorr 2014-11-28 15:03:04 -05:00
parent 3a935822fc
commit 9aa62bd92b

View file

@ -79,8 +79,8 @@ def parse_dockerfile(contents):
for line in lines:
match_command = COMMAND_REGEX.match(line)
if match_command:
command = match_command.group(1).upper()
parameters = match_command.group(2)
command = match_command.group(1).decode('utf-8').upper()
parameters = match_command.group(2).decode('utf-8')
commands.append({
'command': command,
@ -91,5 +91,6 @@ def parse_dockerfile(contents):
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])