mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Files refactor fixes (#2743)
* Fix destroy gallery not destroying file * Re-add minModTime functionality * Deprecate useFileMetadata and stripFileExtension * Optimise files post migration * Decorate moved files. Use first missing file in move * Include path in thumbnail generation error log * Fix stash-box draft submission * Don't destroy files unless deleting * Call handler for files with no associated objects * Fix moved zips causing error on scan
This commit is contained in:
@@ -18,13 +18,13 @@ func (pff PathFilterFunc) Accept(path string) bool {
|
||||
|
||||
// Filter provides a filter function for Files.
|
||||
type Filter interface {
|
||||
Accept(f File) bool
|
||||
Accept(ctx context.Context, f File) bool
|
||||
}
|
||||
|
||||
type FilterFunc func(f File) bool
|
||||
type FilterFunc func(ctx context.Context, f File) bool
|
||||
|
||||
func (ff FilterFunc) Accept(f File) bool {
|
||||
return ff(f)
|
||||
func (ff FilterFunc) Accept(ctx context.Context, f File) bool {
|
||||
return ff(ctx, f)
|
||||
}
|
||||
|
||||
// Handler provides a handler for Files.
|
||||
@@ -40,7 +40,7 @@ type FilteredHandler struct {
|
||||
|
||||
// Handle runs the handler if the filter accepts the file.
|
||||
func (h *FilteredHandler) Handle(ctx context.Context, f File) error {
|
||||
if h.Accept(f) {
|
||||
if h.Accept(ctx, f) {
|
||||
return h.Handler.Handle(ctx, f)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user