Bugfix: Fix parsing array values from osx_defaults (#358) (#1467)

* Bugfix: Fix parsing array values in osx_defaults

Unquote values and unescape double quotes when reading array values from defaults.

* Fix fragments: fix_parsing_array_values_in_osx_defaults

Co-authored-by: Felix Fontein <felix@fontein.de>

* add test code for Bugfix: Fix parsing array values from osx_defaults

* handle spaces after the comma

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1110e93c5d)

Co-authored-by: Kazufumi NOTO <noto.kazufumi@gmail.com>
This commit is contained in:
patchback[bot] 2020-12-09 08:12:28 +01:00 committed by GitHub
parent fb3085e78d
commit d2b1df49c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 2 deletions

View file

@ -237,8 +237,8 @@ class OSXDefaults(object):
value.pop(0)
value.pop(-1)
# Remove extra spaces and comma (,) at the end of values
value = [re.sub(',$', '', x.strip(' ')) for x in value]
# Remove spaces at beginning and comma (,) at the end, unquote and unescape double quotes
value = [re.sub('^ *"?|"?,? *$', '', x.replace('\\"', '"')) for x in value]
return value