mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix interactive speed being lost when file is moved (#4799)
This commit is contained in:
@@ -111,6 +111,7 @@ type File interface {
|
||||
Base() *BaseFile
|
||||
SetFingerprints(fp Fingerprints)
|
||||
Open(fs FS) (io.ReadCloser, error)
|
||||
Clone() File
|
||||
}
|
||||
|
||||
// BaseFile represents a file in the file system.
|
||||
@@ -173,6 +174,12 @@ func (f *BaseFile) Open(fs FS) (io.ReadCloser, error) {
|
||||
return fs.Open(f.Path)
|
||||
}
|
||||
|
||||
func (f *BaseFile) Clone() (ret File) {
|
||||
clone := *f
|
||||
ret = &clone
|
||||
return
|
||||
}
|
||||
|
||||
func (f *BaseFile) Info(fs FS) (fs.FileInfo, error) {
|
||||
return f.info(fs, f.Path)
|
||||
}
|
||||
@@ -249,6 +256,13 @@ func (f ImageFile) GetFormat() string {
|
||||
return f.Format
|
||||
}
|
||||
|
||||
func (f ImageFile) Clone() (ret File) {
|
||||
clone := f
|
||||
clone.BaseFile = f.BaseFile.Clone().(*BaseFile)
|
||||
ret = &clone
|
||||
return
|
||||
}
|
||||
|
||||
// VideoFile is an extension of BaseFile to represent video files.
|
||||
type VideoFile struct {
|
||||
*BaseFile
|
||||
@@ -277,6 +291,13 @@ func (f VideoFile) GetFormat() string {
|
||||
return f.Format
|
||||
}
|
||||
|
||||
func (f VideoFile) Clone() (ret File) {
|
||||
clone := f
|
||||
clone.BaseFile = f.BaseFile.Clone().(*BaseFile)
|
||||
ret = &clone
|
||||
return
|
||||
}
|
||||
|
||||
// #1572 - Inf and NaN values cause the JSON marshaller to fail
|
||||
// Replace these values with 0 rather than erroring
|
||||
|
||||
|
||||
Reference in New Issue
Block a user