diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py
index f5e6085..393e773 100644
--- a/pagure/ui/issues.py
+++ b/pagure/ui/issues.py
@@ -483,9 +483,21 @@ def update_tags(repo, username=None, namespace=None):
error = True
if not (len(tags) == len(colors) == len(tag_descriptions)):
- flask.flash(
- 'tags, tag descriptions and tag colors are not of the same length', 'error')
error = True
+ # store the lengths because we are going to use them a lot
+ len_tags = len(tags)
+ len_tag_descriptions = len(tag_descriptions)
+ len_colors = len(colors)
+ error_message = 'Error: Incomplete request. '
+
+ if len_colors > len_tags or len_tag_descriptions > len_tags:
+ error_message += 'One or more tag fields missing.'
+ elif len_colors < len_tags:
+ error_message += 'One or more tag color fields missing.'
+ elif len_tag_descriptions < len_tags:
+ error_message += 'One or more tag description fields missing.'
+
+ flask.flash(error_message, 'error')
if not error:
for idx, tag in enumerate(tags):
diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py
index d7b169d..3451282 100644
--- a/tests/test_pagure_flask_ui_issues.py
+++ b/tests/test_pagure_flask_ui_issues.py
@@ -2061,6 +2061,25 @@ class PagureFlaskIssuestests(tests.Modeltests):
'
', output.data)
+ # Inconsistent length tags (missing tag field)
+ data = {
+ 'tag': 'red',
+ 'tag_description': ['lorem ipsum', 'foo bar'],
+ 'tag_color': ['#ff0000', '#003cff'],
+ 'csrf_token': csrf_token,
+ }
+ output = self.app.post(
+ '/test/update/tags', data=data, follow_redirects=True)
+ self.assertEqual(output.status_code, 200)
+ self.assertIn(
+ 'Settings - test - Pagure', output.data)
+ self.assertIn(
+ '\n Error: Incomplete request. '
+ 'One or more tag fields missing.', output.data)
+ self.assertIn(
+ ' ', output.data)
+
# Inconsistent length color
data = {
'tag': ['red', 'blue'],
@@ -2078,8 +2097,8 @@ class PagureFlaskIssuestests(tests.Modeltests):
'Color: red does not match the expected pattern',
output.data)
self.assertIn(
- '\n tags, tag descriptions and'
- ' tag colors are not of the same length', output.data)
+ '\n Error: Incomplete request. '
+ 'One or more tag color fields missing.', output.data)
self.assertIn(
' ', output.data)
@@ -2097,8 +2116,8 @@ class PagureFlaskIssuestests(tests.Modeltests):
self.assertIn(
'Settings - test - Pagure', output.data)
self.assertIn(
- '\n tags, tag descriptions and'
- ' tag colors are not of the same length', output.data)
+ '\n Error: Incomplete request. '
+ 'One or more tag description fields missing.', output.data)
self.assertIn(
' ', output.data)