mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	validate hex color strings
This commit is contained in:
		| @@ -171,6 +171,12 @@ class TagSerializer(MatchingModelSerializer): | ||||
|             "document_count" | ||||
|         ) | ||||
|  | ||||
|     def validate_color(self, color): | ||||
|         regex = r"#[0-9a-fA-F]{6}" | ||||
|         if not re.match(regex, color): | ||||
|             raise serializers.ValidationError(_("Invalid color.")) | ||||
|         return color | ||||
|  | ||||
|  | ||||
| class CorrespondentField(serializers.PrimaryKeyRelatedField): | ||||
|     def get_queryset(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler