mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
bug fix: CP-26
This commit is contained in:
@@ -191,6 +191,6 @@ LANGUAGES = (
|
||||
('bn', _('Bangla')),
|
||||
)
|
||||
|
||||
MEDIA_URL = '/home/cyberpanel/media/'
|
||||
MEDIA_URL = '/usr/local/CyberCP/tmp'
|
||||
MEDIA_ROOT = MEDIA_URL
|
||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
|
||||
@@ -595,11 +595,29 @@ class FileManager:
|
||||
finalData['uploadStatus'] = 1
|
||||
finalData['answer'] = 'File transfer completed.'
|
||||
|
||||
### Check if upload path tmp dir is not available
|
||||
|
||||
UploadPath = '/usr/local/CyberCP/tmp/'
|
||||
|
||||
if not os.path.exists(UploadPath):
|
||||
command = 'mkdir %s' % (UploadPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'chown cyberpanel:cyberpanel %s' % (UploadPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'chmod 711 %s' % (UploadPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
## Random file name
|
||||
|
||||
RanddomFileName = str(randint(1000, 9999))
|
||||
|
||||
myfile = self.request.FILES['file']
|
||||
fs = FileSystemStorage()
|
||||
|
||||
try:
|
||||
filename = fs.save(myfile.name, myfile)
|
||||
filename = fs.save(RanddomFileName, myfile)
|
||||
finalData['fileName'] = fs.url(filename)
|
||||
except BaseException as msg:
|
||||
logging.writeToFile('%s. [375:upload]' % (str(msg)))
|
||||
@@ -623,14 +641,14 @@ class FileManager:
|
||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||
|
||||
command = 'cp ' + self.returnPathEnclosed(
|
||||
'/home/cyberpanel/media/' + myfile.name) + ' ' + self.returnPathEnclosed(
|
||||
'/home/cyberpanel/media/' + RanddomFileName) + ' ' + self.returnPathEnclosed(
|
||||
self.data['completePath'] + '/' + myfile.name)
|
||||
ProcessUtilities.executioner(command, website.externalApp)
|
||||
|
||||
self.changeOwner(self.returnPathEnclosed(self.data['completePath'] + '/' + myfile.name))
|
||||
|
||||
try:
|
||||
os.remove(self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name))
|
||||
os.remove(self.returnPathEnclosed(UploadPath + RanddomFileName))
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -639,7 +657,7 @@ class FileManager:
|
||||
|
||||
except BaseException as msg:
|
||||
try:
|
||||
os.remove(self.returnPathEnclosed('/home/cyberpanel/media/' + myfile.name))
|
||||
os.remove(self.returnPathEnclosed(UploadPath + RanddomFileName))
|
||||
except:
|
||||
pass
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
@@ -674,6 +674,9 @@ class preFlightsChecks:
|
||||
command = 'sysctl --system'
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
command = 'chmod 700 %s' % ('/home/cyberpanel')
|
||||
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
###
|
||||
|
||||
def install_unzip(self):
|
||||
|
||||
@@ -2107,6 +2107,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
|
||||
command = 'sysctl --system'
|
||||
Upgrade.executioner(command, 0)
|
||||
|
||||
command = 'chmod 700 %s' % ('/home/cyberpanel')
|
||||
Upgrade.executioner(command, 0)
|
||||
|
||||
Upgrade.stdOut("Permissions updated.")
|
||||
|
||||
except BaseException as msg:
|
||||
|
||||
Reference in New Issue
Block a user