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 sys
|
||||||
import logging
|
import logging
|
||||||
import optparse
|
import optparse
|
||||||
import shlex
|
import re
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
|
@ -163,7 +163,7 @@ class BaseCommand(object):
|
||||||
def split(self, text):
|
def split(self, text):
|
||||||
if deluge.common.windows_check():
|
if deluge.common.windows_check():
|
||||||
text = text.replace('\\', '\\\\')
|
text = text.replace('\\', '\\\\')
|
||||||
return shlex.split(text)
|
return re.split(r"(?<!\\) ", text)
|
||||||
|
|
||||||
def create_parser(self):
|
def create_parser(self):
|
||||||
return OptionParser(prog = self.name,
|
return OptionParser(prog = self.name,
|
||||||
|
|
|
@ -52,7 +52,6 @@ strwidth = format_utils.strwidth
|
||||||
import logging,os
|
import logging,os
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
import shlex
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
LINES_BUFFER_SIZE = 5000
|
LINES_BUFFER_SIZE = 5000
|
||||||
|
@ -602,7 +601,7 @@ class Legacy(BaseMode):
|
||||||
p = " ".join(split(line)[:-1])
|
p = " ".join(split(line)[:-1])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
l_arg = shlex.split(line)[-1]
|
l_arg = split(line)[-1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
l_arg = ""
|
l_arg = ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue