mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
fix: skip directories when creating backup zip for Greenlight workdir
This commit is contained in:
parent
f3f52ac04d
commit
2b58be8ad8
1 changed files with 10 additions and 0 deletions
|
|
@ -149,6 +149,16 @@ func (api *api) CreateBackup(unlockPassword string, w io.Writer) error {
|
|||
}
|
||||
|
||||
for _, fileToArchive := range filesToArchive {
|
||||
info, statErr := os.Stat(fileToArchive)
|
||||
if statErr != nil {
|
||||
logger.Logger.WithError(statErr).WithField("fileToArchive", fileToArchive).Error("Failed to stat file")
|
||||
return fmt.Errorf("failed to stat file %s: %w", fileToArchive, statErr)
|
||||
}
|
||||
if info.IsDir() {
|
||||
logger.Logger.WithField("fileToArchive", fileToArchive).Info("skipping directory")
|
||||
continue
|
||||
}
|
||||
|
||||
logger.Logger.WithField("fileToArchive", fileToArchive).Info("adding file to zip")
|
||||
relPath, err := filepath.Rel(workDir, fileToArchive)
|
||||
if err != nil || strings.HasPrefix(relPath, "..") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue