fix can't create entry

This commit is contained in:
2025-08-17 17:45:50 +02:00
parent a7c85ea3c6
commit 573fba708e
5 changed files with 18 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
package constants
const Version = "0.0.4"
const Version = "0.0.4a"
const ApiVersion = 1

View File

@@ -36,7 +36,7 @@ func (s *Service) Add(name, path, remote string) (string, error) {
ID: gameID.Key(),
Name: name,
Path: path,
Version: 1,
Version: 0,
Date: time.Now(),
}
@@ -268,6 +268,8 @@ func (l Service) PullBackup(gameID, backupID string, cli *client.Client) error {
return fmt.Errorf("failed to pull backup: %w", err)
}
return nil
}

View File

@@ -213,6 +213,13 @@ func (l *LazyRepository) Metadata(id GameIdentifier) (Metadata, error) {
return Metadata{}, fmt.Errorf("corrupted datastore: failed to parse metadata: %w", err)
}
if _, err := os.Stat(filepath.Join(path, "data.tar.gz")); err != nil {
if errors.Is(err, os.ErrNotExist) {
return m, nil
}
return Metadata{}, fmt.Errorf("failed to open archive: %w", err)
}
m.MD5, err = hash.FileMD5(filepath.Join(path, "data.tar.gz"))
if err != nil {
return Metadata{}, fmt.Errorf("failed to calculate md5: %w", err)