🐛 Bug fixes in check attachment

This commit is contained in:
LittleSheep 2024-05-18 20:28:40 +08:00
parent 7d36755a72
commit 4b8bc3e09b
2 changed files with 2 additions and 4 deletions

View File

@ -94,7 +94,7 @@ func createPost(c *fiber.Ctx) error {
} }
for _, attachment := range data.Attachments { for _, attachment := range data.Attachments {
if services.CheckAttachmentByUUIDExists(attachment, "i.attachment") { if !services.CheckAttachmentByUUIDExists(attachment, "i.attachment") {
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment)) return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment))
} }
} }
@ -170,7 +170,7 @@ func editPost(c *fiber.Ctx) error {
} }
for _, attachment := range data.Attachments { for _, attachment := range data.Attachments {
if services.CheckAttachmentByUUIDExists(attachment, "i.attachment") { if !services.CheckAttachmentByUUIDExists(attachment, "i.attachment") {
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment)) return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment))
} }
} }

View File

@ -7,8 +7,6 @@ bind = "0.0.0.0:8445"
domain = "im.solsynth.dev" domain = "im.solsynth.dev"
secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi" secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi"
content = "uploads"
[debug] [debug]
database = false database = false
print_routes = false print_routes = false