[Files Refactor] Bug fixes (#2868)

* Return error if multiple rows returned for id
* Add missing LoadFiles calls
* Show id if path is empty
This commit is contained in:
WithoutPants
2022-09-02 11:18:37 +10:00
parent 273cf0383d
commit 94d39da706
23 changed files with 93 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ package models
import (
"context"
"strconv"
"time"
"github.com/stashapp/stash/pkg/file"
@@ -128,6 +129,20 @@ func (g Gallery) GetTitle() string {
return g.Path
}
// DisplayName returns a display name for the scene for logging purposes.
// It returns the path or title, or otherwise it returns the ID if both of these are empty.
func (g Gallery) DisplayName() string {
if g.Path != "" {
return g.Path
}
if g.Title != "" {
return g.Title
}
return strconv.Itoa(g.ID)
}
const DefaultGthumbWidth int = 640
type Galleries []*Gallery