✨ Self reference detection
This commit is contained in:
@ -187,7 +187,7 @@ func AnalyzeAttachment(file models.Attachment) error {
|
||||
|
||||
start = time.Now()
|
||||
|
||||
// Move temporary to permanet
|
||||
// Move temporary to permanent
|
||||
if !linked {
|
||||
if err := ReUploadFileToPermanent(file); err != nil {
|
||||
return fmt.Errorf("unable to move file to permanet storage: %v", err)
|
||||
|
@ -109,6 +109,10 @@ func TryLinkAttachment(tx *gorm.DB, og models.Attachment, hash string) (bool, er
|
||||
og.Uuid = prev.Uuid
|
||||
og.Destination = prev.Destination
|
||||
|
||||
if og.AccountID == prev.AccountID {
|
||||
og.IsSelfRef = true
|
||||
}
|
||||
|
||||
if err := tx.Save(&og).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return true, err
|
||||
|
Reference in New Issue
Block a user