Backups - Hide incomplete/running backups from being downloaded

pull/2757/head
dgtlmoon 2 months ago
parent 33c83230a6
commit 942625e1fb

@ -22,7 +22,7 @@ def create_backup(datastore_path, watches: dict):
backupname = BACKUP_FILENAME_FORMAT.format(timestamp)
backup_filepath = os.path.join(datastore_path, backupname)
with zipfile.ZipFile(backup_filepath, "w",
with zipfile.ZipFile(backup_filepath.replace('.zip', '.tmp'), "w",
compression=zipfile.ZIP_DEFLATED,
compresslevel=8) as zipObj:
@ -70,6 +70,9 @@ def create_backup(datastore_path, watches: dict):
compresslevel=8,
)
# Now it's done, rename it so it shows up finally and its completed being written.
os.rename(backup_filepath.replace('.zip', '.tmp'), backup_filepath.replace('.tmp', '.zip'))
def construct_blueprint(datastore: ChangeDetectionStore):
backups_blueprint = Blueprint('backups', __name__, template_folder="templates")

Loading…
Cancel
Save