🐛 Fix uuid duplicate when link exists

This commit is contained in:
LittleSheep 2024-05-18 22:26:00 +08:00
parent 4607e18fb3
commit a5a6503af9
2 changed files with 5 additions and 3 deletions

View File

@ -4,9 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":sparkles: Provide a faster check attachment exists grpc method">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":truck: Update url mapping">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/server/startup.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/server/startup.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/services/attachments.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/attachments.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -70,7 +70,8 @@
<component name="VcsManagerConfiguration">
<MESSAGE value=":sparkles: Upload attachment requires permission check" />
<MESSAGE value=":sparkles: Provide a faster check attachment exists grpc method" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Provide a faster check attachment exists grpc method" />
<MESSAGE value=":truck: Update url mapping" />
<option name="LAST_COMMIT_MESSAGE" value=":truck: Update url mapping" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -50,6 +50,7 @@ func NewAttachmentMetadata(tx *gorm.DB, user models.Account, file *multipart.Fil
linked = true
attachment = exists
attachment.ID = 0
attachment.Uuid = uuid.NewString()
attachment.AccountID = user.ID
} else {
// Upload the new file