#3427 Ensure we are consistent about the character set allowed in tags
Merged 2 years ago by pingou. Opened 2 years ago by pingou.

file modified
+6 -4
@@ -502,7 +502,8 @@ 

  

          return flask.redirect(flask.url_for(

              'ui_ns.view_settings', repo=repo.name, username=username,

-             namespace=repo.namespace))

+             namespace=repo.namespace) + '#projecttags-tab')

+ 

      elif flask.request.method == 'GET':

          tag_color = tagobj.tag_color

          if tag_color == 'DeepSkyBlue':
@@ -557,10 +558,11 @@ 

              if col.strip()

          ]

  

+         pattern = re.compile(pagure.forms.TAGS_REGEX, re.IGNORECASE)

          for tag in tags:

-             if '/' in tag:

+             if not pattern.match(tag):

                  flask.flash(

-                     'Tag: %s contains an invalid character: "/"' % tag,

+                     'Tag: %s contains one or more invalid characters' % tag,

                      'error')

                  error = True

  
@@ -648,7 +650,7 @@ 

  

      return flask.redirect(flask.url_for(

          'ui_ns.view_settings', repo=repo.name, username=username,

-         namespace=repo.namespace)

+         namespace=repo.namespace) + '#projecttags-tab'

      )

  

  

@@ -3409,7 +3409,7 @@ 

                  '<title>Settings - test - Pagure</title>', output_text)

              self.assertIn(

                  ''

-                 'Tag: red/green contains an invalid character: &#34;/&#34;',

+                 'Tag: red/green contains one or more invalid characters',

                  output_text)

              self.assertIn(

                  '<h5 class="pl-2 font-weight-bold text-muted">Project '

1 new commit added

  • Fix a couple of redirects so the user comes back to the right tab
2 years ago

rebased onto 7186a48

2 years ago

rebased onto 9c590b89b55beba5d11a69b79622830b373dd99c

2 years ago

rebased onto fc8b3f1

2 years ago

rebased onto 9c590b89b55beba5d11a69b79622830b373dd99c

2 years ago

rebased onto fc8b3f1

2 years ago

rebased onto c1ab2bb79cdf5d92ac73ae3767249e998cf7d96e

2 years ago

rebased onto c68643cb8bc5945ed7215932ef010b8b7aeda90d

2 years ago

rebased onto 422e36c

2 years ago

Pull-Request has been merged by pingou

2 years ago