From 8ae0317014b5d11769c1fb3ea2b685b18242d3f6 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 31 Mar 2015 07:13:13 -0500 Subject: [PATCH] bpd: Process commands as bytes (fix #1388) --- beetsplug/bpd/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beetsplug/bpd/__init__.py b/beetsplug/bpd/__init__.py index 1453fe912..b998f5047 100644 --- a/beetsplug/bpd/__init__.py +++ b/beetsplug/bpd/__init__.py @@ -639,8 +639,8 @@ class Command(object): """A command issued by the client for processing by the server. """ - command_re = re.compile(r'^([^ \t]+)[ \t]*') - arg_re = re.compile(r'"((?:\\"|[^"])+)"|([^ \t"]+)') + command_re = re.compile(br'^([^ \t]+)[ \t]*') + arg_re = re.compile(br'"((?:\\"|[^"])+)"|([^ \t"]+)') def __init__(self, s): """Creates a new `Command` from the given string, `s`, parsing @@ -655,7 +655,7 @@ class Command(object): if match[0]: # Quoted argument. arg = match[0] - arg = arg.replace('\\"', '"').replace('\\\\', '\\') + arg = arg.replace(b'\\"', b'"').replace(b'\\\\', b'\\') else: # Unquoted argument. arg = match[1]