Don't send file path to server (!)

This commit is contained in:
Et0h 2015-10-01 18:17:49 +01:00
parent 04054c3078
commit a169467284
2 changed files with 16 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import ast
from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor, task
from functools import wraps
from copy import deepcopy
from syncplay.protocols import SyncClientProtocol
from syncplay import utils, constants
from syncplay.messages import getMissingStrings, getMessage
@ -420,8 +421,20 @@ class SyncplayClient(object):
def setServerVersion(self, version):
self.serverVersion = version
def getSanitizedCurrentUserFile(self):
if self.userlist.currentUser.file:
file_ = deepcopy(self.userlist.currentUser.file)
if constants.PRIVATE_FILE_FIELDS:
for PrivateField in constants.PRIVATE_FILE_FIELDS:
if file_.has_key(PrivateField):
file_.pop(PrivateField)
return file_
else:
return None
def sendFile(self):
file_ = self.userlist.currentUser.file
file_ = self.getSanitizedCurrentUserFile()
if self._protocol and self._protocol.logged and file_:
self._protocol.sendFileSetting(file_)

View File

@ -180,3 +180,5 @@ FILEITEM_SWITCH_STREAM_SWITCH = 2
SYNCPLAY_UPDATE_URL = u"http://syncplay.pl/checkforupdate?{}" # Params
SYNCPLAY_DOWNLOAD_URL = "http://syncplay.pl/download/"
SYNCPLAY_PUBLIC_SERVER_LIST_URL = u"http://syncplay.pl/listpublicservers?{}" # Params
PRIVATE_FILE_FIELDS = ["path"]