From f2dc2c0f85d1953301f725e6e89a32743a0c594c Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Tue, 23 Jul 2024 10:12:17 +0200 Subject: [PATCH] only create snapshots if not in maintenance mode --- web/filebrowser_download.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/filebrowser_download.go b/web/filebrowser_download.go index 1320aa2c..e272900c 100644 --- a/web/filebrowser_download.go +++ b/web/filebrowser_download.go @@ -89,6 +89,8 @@ func createSqliteSnapshot(filename string) (string, error) { } func (a *Api) DownloadZip(w http.ResponseWriter, r *http.Request, claims *types.Claims) { + maintenance := a.app.MaintenanceMode.Load() + reldir, absdir, err := a.get_sanitized_dir(r) if err != nil { SendError(w, 500, err.Error()) @@ -119,7 +121,7 @@ func (a *Api) DownloadZip(w http.ResponseWriter, r *http.Request, claims *types. relPath := strings.TrimPrefix(filePath, absdir) relPath = strings.TrimPrefix(relPath, "/") - if isSqliteDatabase(filePath) { + if isSqliteDatabase(filePath) && !maintenance { tmppath, err := createSqliteSnapshot(filePath) if err != nil { return fmt.Errorf("sqlite snapshot error for '%s': %v", filePath, err) @@ -161,6 +163,8 @@ func (a *Api) DownloadZip(w http.ResponseWriter, r *http.Request, claims *types. } func (a *Api) DownloadTarGZ(w http.ResponseWriter, r *http.Request, claims *types.Claims) { + maintenance := a.app.MaintenanceMode.Load() + reldir, absdir, err := a.get_sanitized_dir(r) if err != nil { SendError(w, 500, err.Error()) @@ -199,7 +203,7 @@ func (a *Api) DownloadTarGZ(w http.ResponseWriter, r *http.Request, claims *type } fi.Name = relPath - if isSqliteDatabase(filePath) { + if isSqliteDatabase(filePath) && !maintenance { tmppath, err := createSqliteSnapshot(filePath) if err != nil { return fmt.Errorf("sqlite snapshot error for '%s': %v", filePath, err)