mirror of https://github.com/stashapp/stash.git
Fix backup issues (#2966)
Make backup directory setting optional. Use the basename of the database file for the naming.
This commit is contained in:
parent
9e44e13f6d
commit
7b83d81820
|
@ -86,7 +86,7 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input ConfigGen
|
|||
|
||||
existingBackupDirectoryPath := c.GetBackupDirectoryPath()
|
||||
if input.BackupDirectoryPath != nil && existingBackupDirectoryPath != *input.BackupDirectoryPath {
|
||||
if err := validateDir(config.BackupDirectoryPath, *input.BackupDirectoryPath, false); err != nil {
|
||||
if err := validateDir(config.BackupDirectoryPath, *input.BackupDirectoryPath, true); err != nil {
|
||||
return makeConfigGeneralResult(), err
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ func (db *Database) DatabasePath() string {
|
|||
}
|
||||
|
||||
func (db *Database) DatabaseBackupPath(backupDirectoryPath string) string {
|
||||
fn := fmt.Sprintf("%s.%d.%s", db.dbPath, db.schemaVersion, time.Now().Format("20060102_150405"))
|
||||
fn := fmt.Sprintf("%s.%d.%s", filepath.Base(db.dbPath), db.schemaVersion, time.Now().Format("20060102_150405"))
|
||||
|
||||
if backupDirectoryPath != "" {
|
||||
return filepath.Join(backupDirectoryPath, fn)
|
||||
|
|
Loading…
Reference in New Issue