fix error

This commit is contained in:
2025-08-06 23:17:29 +02:00
parent 2f777c72ee
commit 898012a30d

View File

@@ -146,11 +146,6 @@ func ArchiveInfo(gameID, documentRoot, uuid string) (repository.Backup, error) {
return repository.Backup{}, err
}
v, err := getVersion(gameID, documentRoot)
if err != nil {
return repository.Backup{}, fmt.Errorf("failed to read game metadata: %w", err)
}
if m, ok := hashCache.Get(cacheID); ok {
return repository.Backup{
CreatedAt: finfo.ModTime(),
@@ -165,7 +160,6 @@ func ArchiveInfo(gameID, documentRoot, uuid string) (repository.Backup, error) {
}
hashCache.Register(cacheID, cachedInfo{
Version: v,
MD5: h,
})
@@ -217,7 +211,7 @@ func Hash(gameID, documentRoot string) (string, error) {
func getVersion(gameID, documentRoot string) (int, error) {
path := filepath.Join(documentRoot, "data", gameID, "metadata.json")
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0740)
f, err := os.OpenFile(path, os.O_RDONLY, 0)
if err != nil {
return 0, err
}