Do not use shlex for splitting as it breaks on torrents containing quotes

This commit is contained in:
Asmageddon 2012-05-26 20:02:08 +02:00
parent fa1a1eb939
commit d7391611dd
2 changed files with 3 additions and 4 deletions

View File

@ -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,

View File

@ -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 = ""