Skip to content
Permalink
Browse files
path check to upload
  • Loading branch information
usmannasir committed Jan 18, 2020
1 parent 5c491a2 commit f8ba1094a448a17f9ccae6ab9dacbb64e3a02842
Showing with 2 additions and 1 deletion.
  1. +2 −1 filemanager/filemanager.py
@@ -334,8 +334,9 @@ def upload(self):
fs = FileSystemStorage()
filename = fs.save(myfile.name, myfile)
finalData['fileName'] = fs.url(filename)
pathCheck = '/home/%s' % (self.data['domainName'])

if not self.data['completePath'].find(self.data['home']) > -1:
if self.data['completePath'].find(pathCheck) == -1:
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')

command = 'mv ' + self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name) + ' ' + self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name)

0 comments on commit f8ba109

Please sign in to comment.