From 56b4fd45fd0d6b1899cb6aebcb785e8aee867269 Mon Sep 17 00:00:00 2001 From: Thomas Miceli <27960254+thomiceli@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:14:56 +0200 Subject: [PATCH] Add queriable shorter uuids (#338) --- internal/db/gist.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/db/gist.go b/internal/db/gist.go index 5b269342..0cc8c79b 100644 --- a/internal/db/gist.go +++ b/internal/db/gist.go @@ -101,7 +101,7 @@ func (gist *Gist) BeforeDelete(tx *gorm.DB) error { func GetGist(user string, gistUuid string) (*Gist, error) { gist := new(Gist) err := db.Preload("User").Preload("Forked.User"). - Where("(gists.uuid = ? OR gists.url = ?) AND users.username like ?", gistUuid, gistUuid, user). + Where("(gists.uuid like ? OR gists.url = ?) AND users.username like ?", gistUuid+"%", gistUuid, user). Joins("join users on gists.user_id = users.id"). First(&gist).Error