diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8105660..d5237a7 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,12 @@
-
+
+
+
+
+
+
@@ -33,28 +38,28 @@
- {
+ "keyToString": {
+ "DefaultGoTemplateProperty": "Go File",
+ "Go Build.Backend.executor": "Run",
+ "Go 构建.Backend.executor": "Run",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.go.formatter.settings.were.checked": "true",
+ "RunOnceActivity.go.migrated.go.modules.settings": "true",
+ "RunOnceActivity.go.modules.automatic.dependencies.download": "true",
+ "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
+ "git-widget-placeholder": "master",
+ "go.import.settings.migrated": "true",
+ "go.sdk.automatically.set": "true",
+ "last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hydrogen/Paperclip/pkg/internal/grpc",
+ "node.js.detected.package.eslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "run.code.analysis.last.selected.profile": "pProject Default",
+ "settings.editor.selected.configurable": "preferences.pluginManager",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -83,8 +88,8 @@
-
-
+
+
diff --git a/pkg/internal/models/attachments.go b/pkg/internal/models/attachments.go
index bcd187d..08f82fe 100644
--- a/pkg/internal/models/attachments.go
+++ b/pkg/internal/models/attachments.go
@@ -25,6 +25,7 @@ type Attachment struct {
Metadata datatypes.JSONMap `json:"metadata"`
IsMature bool `json:"is_mature"`
IsAnalyzed bool `json:"is_analyzed"`
+ IsSelfRef bool `json:"is_self_ref"`
Ref *Attachment `json:"ref"`
RefID *uint `json:"ref_id"`
diff --git a/pkg/internal/services/analyzer.go b/pkg/internal/services/analyzer.go
index f3fcd01..e69413a 100644
--- a/pkg/internal/services/analyzer.go
+++ b/pkg/internal/services/analyzer.go
@@ -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)
diff --git a/pkg/internal/services/attachments.go b/pkg/internal/services/attachments.go
index fc5c1b2..5119dd2 100644
--- a/pkg/internal/services/attachments.go
+++ b/pkg/internal/services/attachments.go
@@ -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