Skip to content

Commit

Permalink
path check to upload
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jan 18, 2020
1 parent 5c491a2 commit f8ba109
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion filemanager/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f8ba109

Please sign in to comment.