From 7ab9409ef05f0baa40099832a9b02f6651a0ad4b Mon Sep 17 00:00:00 2001 From: neviyn Date: Thu, 29 Apr 2021 22:25:35 +0100 Subject: [PATCH] Improved validation on tag terms --- src/main/kotlin/uk/co/neviyn/booru/Entity.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/uk/co/neviyn/booru/Entity.kt b/src/main/kotlin/uk/co/neviyn/booru/Entity.kt index 047de0c..d80f443 100644 --- a/src/main/kotlin/uk/co/neviyn/booru/Entity.kt +++ b/src/main/kotlin/uk/co/neviyn/booru/Entity.kt @@ -8,6 +8,7 @@ import javax.persistence.JoinColumn import javax.persistence.JoinTable import javax.persistence.ManyToMany import javax.persistence.ManyToOne +import javax.validation.constraints.Pattern @Entity open class User( @@ -56,6 +57,7 @@ open class Image( @Entity open class Tag( @Column(unique = true) + @Pattern(regexp = "[a-zA-Z0-9_]*") // Only allow alphanumeric and underscores open var tag: String = "", @Id open var id: Long = -1 ) \ No newline at end of file