From d9280d694501afb2df6c12b3f9778beb73f350a0 Mon Sep 17 00:00:00 2001 From: Brendan Reilly Date: Apr 25 2017 18:07:52 +0000 Subject: Increase 50 character limit of tag names --- diff --git a/docs/schema-upgrade-1.12-1.13.sql b/docs/schema-upgrade-1.12-1.13.sql new file mode 100644 index 0000000..5a87ec3 --- /dev/null +++ b/docs/schema-upgrade-1.12-1.13.sql @@ -0,0 +1,9 @@ +-- upgrade script to migrate the Koji database schema +-- from version 1.12 to 1.13 + +BEGIN; + +-- Change VARCHAR field for tag names to TEXT to allow longer tag names +ALTER TABLE tag ALTER COLUMN name TYPE TEXT; + +COMMIT; diff --git a/docs/schema.sql b/docs/schema.sql index 18bff30..fc081a7 100644 --- a/docs/schema.sql +++ b/docs/schema.sql @@ -278,7 +278,7 @@ CREATE TABLE build_types ( CREATE TABLE tag ( id SERIAL NOT NULL PRIMARY KEY, - name VARCHAR(50) UNIQUE NOT NULL + name TEXT UNIQUE NOT NULL ) WITHOUT OIDS; -- CREATE INDEX tag_by_name ON tag (name); diff --git a/hub/kojihub.py b/hub/kojihub.py index e845037..8c344f1 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -2878,6 +2878,11 @@ def create_tag(name, parent=None, arches=None, perm=None, locked=False, maven_su def _create_tag(name, parent=None, arches=None, perm=None, locked=False, maven_support=False, maven_include_all=False, extra=None): """Create a new tag, without access check""" + max_name_length = 256 + if len(name) > max_name_length: + raise koji.GenericError("Tag name %s is too long. Max length is %s characters", + name, max_name_length) + if not context.opts.get('EnableMaven') and (maven_support or maven_include_all): raise koji.GenericError("Maven support not enabled")