fix: fix encoding error if string contains backslashes (#152)

This commit is contained in:
Robert Kaussow 2021-06-07 16:28:14 +02:00 committed by GitHub
parent 8d039ccb7d
commit 1652014f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ class CheckNativeYaml(StandardBase):
if isinstance(task[action], dict): if isinstance(task[action], dict):
continue continue
# strip additional newlines off task[action] # strip additional newlines off task[action]
task_action = bytes(task[action].strip(), "utf-8").decode("unicode_escape") task_action = bytes(repr(task[action].strip()), "utf-8").decode("unicode_escape")
if task_action.split() != arguments: if task_action.split() != arguments:
errors.append(self.Error(task["__line__"], self.helptext)) errors.append(self.Error(task["__line__"], self.helptext))
return self.Result(candidate.path, errors) return self.Result(candidate.path, errors)