Skip to content

Commit

Permalink
only create snapshots if not in maintenance mode
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jul 23, 2024
1 parent 05bbcf6 commit f2dc2c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/filebrowser_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f2dc2c0

Please sign in to comment.