Do not use shlex for splitting as it breaks on torrents containing quotes
This commit is contained in:
parent
fa1a1eb939
commit
d7391611dd
|
@ -38,7 +38,7 @@ import os
|
|||
import sys
|
||||
import logging
|
||||
import optparse
|
||||
import shlex
|
||||
import re
|
||||
import locale
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
|
@ -163,7 +163,7 @@ class BaseCommand(object):
|
|||
def split(self, text):
|
||||
if deluge.common.windows_check():
|
||||
text = text.replace('\\', '\\\\')
|
||||
return shlex.split(text)
|
||||
return re.split(r"(?<!\\) ", text)
|
||||
|
||||
def create_parser(self):
|
||||
return OptionParser(prog = self.name,
|
||||
|
|
|
@ -52,7 +52,6 @@ strwidth = format_utils.strwidth
|
|||
import logging,os
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
import shlex
|
||||
import re
|
||||
|
||||
LINES_BUFFER_SIZE = 5000
|
||||
|
@ -602,7 +601,7 @@ class Legacy(BaseMode):
|
|||
p = " ".join(split(line)[:-1])
|
||||
|
||||
try:
|
||||
l_arg = shlex.split(line)[-1]
|
||||
l_arg = split(line)[-1]
|
||||
except IndexError:
|
||||
l_arg = ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue