Sharing: Verify that record exists before proceeding with upload #3379
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
1c6fae544c
commit
232ec78c56
1 changed files with 11 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/photoprism/photoprism/internal/remote/webdav"
|
||||
"github.com/photoprism/photoprism/internal/search"
|
||||
"github.com/photoprism/photoprism/internal/thumb"
|
||||
"github.com/photoprism/photoprism/pkg/clean"
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
)
|
||||
|
||||
|
@ -100,6 +101,16 @@ func (w *Share) Start() (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Skip deleted files.
|
||||
if file.File == nil || file.FileID <= 0 {
|
||||
log.Warnf("share: %s cannot be uploaded because it has been deleted", clean.Log(file.RemoteName))
|
||||
file.Status = entity.FileShareError
|
||||
file.Error = "file not found"
|
||||
file.Errors++
|
||||
w.logError(entity.Db().Save(&file).Error)
|
||||
continue
|
||||
}
|
||||
|
||||
dir := path.Dir(file.RemoteName)
|
||||
|
||||
// Ensure remote folder exists.
|
||||
|
|
Loading…
Reference in a new issue