diff --git a/model/sharing/files.go b/model/sharing/files.go index b0d043b48b9..73718b095d0 100644 --- a/model/sharing/files.go +++ b/model/sharing/files.go @@ -339,6 +339,11 @@ func (s *Sharing) GetSharingDir(inst *instance.Instance) (*vfs.DirDoc, error) { fs := inst.VFS() rule := s.FirstFilesRule() if rule != nil { + if rule.Mime != "" { + inst.Logger().WithNamespace("sharing"). + Warnf("GetSharingDir called for only one file: %s", s.SID) + return nil, ErrInternalServerError + } dir, _ := fs.DirByID(rule.Values[0]) if dir != nil { return dir, nil diff --git a/model/sharing/sharing.go b/model/sharing/sharing.go index 861db2f9832..4f5ccfbfc4f 100644 --- a/model/sharing/sharing.go +++ b/model/sharing/sharing.go @@ -800,7 +800,7 @@ func (s *Sharing) EndInitial(inst *instance.Instance) error { M: map[string]interface{}{"_id": s.SID}, } realtime.GetHub().Publish(inst, realtime.EventDelete, &doc, nil) - if s.FirstFilesRule() != nil { + if rule := s.FirstFilesRule(); rule != nil && rule.Mime == "" { if _, err := s.GetSharingDir(inst); err != nil { return err }