Merge pull request #10966 from Mangesh-Khairnar/fix-google-drive

fix(google-drive): fetch basename for backup
This commit is contained in:
Chinmay Pai 2020-07-10 10:40:14 +05:30 committed by GitHub
commit 8a4f390321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,10 +189,10 @@ def upload_system_backup_to_google_drive():
if frappe.flags.create_new_backup:
set_progress(1, "Backing up Data.")
backup = new_backup()
fileurl_backup = os.path.basename(backup.backup_path_db)
fileurl_site_config = os.path.basename(backup.site_config_backup_path)
fileurl_public_files = os.path.basename(backup.backup_path_files)
fileurl_private_files = os.path.basename(backup.backup_path_private_files)
fileurl_backup = backup.backup_path_db
fileurl_site_config = backup.site_config_backup_path
fileurl_public_files = backup.backup_path_files
fileurl_private_files = backup.backup_path_private_files
else:
fileurl_backup, fileurl_site_config, fileurl_public_files, fileurl_private_files = get_latest_backup_file(with_files=True)
@ -208,7 +208,7 @@ def upload_system_backup_to_google_drive():
try:
media = MediaFileUpload(get_absolute_path(filename=fileurl), mimetype="application/gzip", resumable=True)
except IOError as e:
frappe.throw(_("Google Drive - Could not locate locate - {0}").format(e))
frappe.throw(_("Google Drive - Could not locate - {0}").format(e))
try:
set_progress(2, "Uploading backup to Google Drive.")
@ -232,7 +232,7 @@ def weekly_backup():
upload_system_backup_to_google_drive()
def get_absolute_path(filename):
file_path = os.path.join(get_backups_path()[2:], filename)
file_path = os.path.join(get_backups_path()[2:], os.path.basename(filename))
return "{0}/sites/{1}".format(get_bench_path(), file_path)
def set_progress(progress, message):