mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
check that path is within root folder of set
This commit is contained in:
parent
061fd3efed
commit
3ee2cb0414
@ -531,4 +531,8 @@ msgstr ""
|
|||||||
|
|
||||||
msgctxt "#30135"
|
msgctxt "#30135"
|
||||||
msgid "Add Include Folder"
|
msgid "Add Include Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30136"
|
||||||
|
msgid "Path must be within root folder"
|
||||||
msgstr ""
|
msgstr ""
|
@ -78,6 +78,9 @@ class AdvancedBackupEditor:
|
|||||||
def _cleanPath(self,root,path):
|
def _cleanPath(self,root,path):
|
||||||
return path[len(root)-1:]
|
return path[len(root)-1:]
|
||||||
|
|
||||||
|
def _validatePath(self,root,path):
|
||||||
|
return path.startswith(root)
|
||||||
|
|
||||||
def createSet(self):
|
def createSet(self):
|
||||||
backupSet = None
|
backupSet = None
|
||||||
|
|
||||||
@ -127,13 +130,16 @@ class AdvancedBackupEditor:
|
|||||||
#add a folder, will equal root if cancel is hit
|
#add a folder, will equal root if cancel is hit
|
||||||
addFolder = self.dialog.browse(type=0,heading=utils.getString(30120),shares='files',defaultt=backupSet['root'])
|
addFolder = self.dialog.browse(type=0,heading=utils.getString(30120),shares='files',defaultt=backupSet['root'])
|
||||||
|
|
||||||
#cannot add root as an exclusion
|
if(addFolder.startswith(rootPath)):
|
||||||
if(optionSelected == 0 and addFolder != backupSet['root']):
|
#cannot add root as an exclusion
|
||||||
backupSet['dirs'].append({"path":addFolder,"type":"exclude"})
|
if(optionSelected == 0 and addFolder != backupSet['root']):
|
||||||
elif(optionSelected == 1):
|
backupSet['dirs'].append({"path":addFolder,"type":"exclude"})
|
||||||
#can add root as inclusion
|
elif(optionSelected == 1):
|
||||||
backupSet['dirs'].append({"path":addFolder,"type":"include","recurse":True})
|
#can add root as inclusion
|
||||||
|
backupSet['dirs'].append({"path":addFolder,"type":"include","recurse":True})
|
||||||
|
else:
|
||||||
|
#folder must be under root folder
|
||||||
|
self.dialog.ok(utils.getString(30117), utils.getString(30136),rootPath)
|
||||||
elif(optionSelected == 2):
|
elif(optionSelected == 2):
|
||||||
self.dialog.ok(utils.getString(30121),utils.getString(30130),backupSet['root'])
|
self.dialog.ok(utils.getString(30121),utils.getString(30130),backupSet['root'])
|
||||||
elif(optionSelected > 2):
|
elif(optionSelected > 2):
|
||||||
|
Loading…
Reference in New Issue
Block a user