Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-23729

" in Failed Validation Message causes broken validation message

    Details

    • Similar Issues:

      Description

      Enter " as part of the "Failed Validation Message" of a Validated-String-Parameter.
      When opening the job and you are asked for parameters below the Parameter an "ERROR"-Text is shown as a link instead of the failed validation message. The link cannot be opened, as the URL is invalid.
      As a workaround " must be escaped like this: \"

        Attachments

          Issue Links

            Activity

            Hide
            kalabase kalabase lebelo added a comment -

            Alex Earl I see with below commit  you removed the code that Leo Hu mentions, what was the reason for removing, Leo's solution not work?

             

            I still get this error when using this plugin in a Jenkins pipeline

             

            https://github.com/jenkinsci/validating-string-parameter-plugin/commit/9caac7b713976af9363cd944f89cadd44fbb4652#diff-12cb1c400787ab164b54d0ef8d0cbda9

            Show
            kalabase kalabase lebelo added a comment - Alex Earl I see with below commit  you removed the code that Leo Hu mentions, what was the reason for removing, Leo's solution not work?   I still get this error when using this plugin in a Jenkins pipeline   https://github.com/jenkinsci/validating-string-parameter-plugin/commit/9caac7b713976af9363cd944f89cadd44fbb4652#diff-12cb1c400787ab164b54d0ef8d0cbda9
            Hide
            lhschema Leo Hu added a comment -

            Awesome I figured it out!
            Modified the code to use the resURL instead of the rootURL
            rootURL - the Jenkins instance
            resURL - static webapp resources such as JavaScript or HTML (cf. Jenkins.RESOURCE_PATH)

            Not sure why resURL works while rootURL doesn't but it might be that rootURL doesn't have a proper context path in our setup or something so it might not be pointing to localhost:8080.

            Changed checkUrl below, rebuild plugin in maven, installed manually and it worked.

            checkUrl="'${it.resURL}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex='+encodeURIComponent("${it.jsEncodedRegex}")+'&failedValidationMessage='+encodeURIComponent("${it.failedValidationMessage}")+'&value='+encodeURIComponent(this.value)"
            
            Show
            lhschema Leo Hu added a comment - Awesome I figured it out! Modified the code to use the resURL instead of the rootURL rootURL - the Jenkins instance resURL - static webapp resources such as JavaScript or HTML (cf. Jenkins.RESOURCE_PATH) Not sure why resURL works while rootURL doesn't but it might be that rootURL doesn't have a proper context path in our setup or something so it might not be pointing to localhost:8080. Changed checkUrl below, rebuild plugin in maven, installed manually and it worked. checkUrl= " '${it.resURL}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex=' +encodeURIComponent("${it.jsEncodedRegex}")+ '&failedValidationMessage=' +encodeURIComponent("${it.failedValidationMessage}")+ '&value=' +encodeURIComponent( this .value)"
            Hide
            lhschema Leo Hu added a comment -

            I'm still having the same problem now after the latest jenkins update.
            I was able to pinpoint what was causing the "ERROR" message, it's the index.jelly file under

            src/main/resources/hudson/plugins/validating_string_parameter/ValidatingStringParameterDefinition/index.jelly
            
            <div name="parameter" description="${it.formattedDescription}">
                                    <input type="hidden" name="name" value="${it.name}" />
                                    <f:textbox name="value" value="${it.defaultValue}"
                                            *checkUrl="'${it.rootUrl}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex='+encodeURIComponent(&quot;${it.jsEncodedRegex}&quot;)+'&amp;failedValidationMessage='+encodeURIComponent(&quot;${it.failedValidationMessage}&quot;)+'&amp;value='+encodeURIComponent(this.value)"*/>
                            </div>
            

            There's something wrong with the checkUrl descriptor that errors out..wish it was easier to read so I can debug it. Removing it removes the ERROR, but probably removes the regex validating.

            If anyone knows how to fix it, please let me know.

            Show
            lhschema Leo Hu added a comment - I'm still having the same problem now after the latest jenkins update. I was able to pinpoint what was causing the "ERROR" message, it's the index.jelly file under src/main/resources/hudson/plugins/validating_string_parameter/ValidatingStringParameterDefinition/index.jelly <div name= "parameter" description= "${it.formattedDescription}" > <input type= "hidden" name= "name" value= "${it.name}" /> <f:textbox name= "value" value= "${it.defaultValue}" *checkUrl= " '${it.rootUrl}/descriptor/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex=' +encodeURIComponent(&quot;${it.jsEncodedRegex}&quot;)+ '&amp;failedValidationMessage=' +encodeURIComponent(&quot;${it.failedValidationMessage}&quot;)+ '&amp;value=' +encodeURIComponent( this .value)" */> </div> There's something wrong with the checkUrl descriptor that errors out..wish it was easier to read so I can debug it. Removing it removes the ERROR, but probably removes the regex validating. If anyone knows how to fix it, please let me know.
            Hide
            lhschema Leo Hu added a comment -

            I had a similar issue, but when I installed the plugin and tried to use it, it would always show the text "ERROR" below it but I think the regex match work.
            This made the plugin unusable since people wouldn't know when/if they were typing in an error.
            However, I was able to fix it by doing a fresh install of jenkins through a build after downloading version 2.3 github repo.(NOTE version 2.4 doesn't work)

            wget https://github.com/jenkinsci/validating-string-parameter-plugin/archive/validating-string-parameter-2.3.tar.gz
            #install maven
            mvn -X package
            #Uninstall the validating-string-parameter plugin + deleted the directory /var/lib/jenkins/plugins/validating-string-parameter
            #Manually uploaded the 
            validating-string-parameter.hpi 
            

            Pretty crazy workaround since I literally used the same code as in the plugin downloaded from jenkins but it seems the custom build and upload worked for some reason. I didn't see anything different in the jelly conf or java files so it's strange but this works. Hope this helps someone out since this parameter plugin is pretty essential.

            Show
            lhschema Leo Hu added a comment - I had a similar issue, but when I installed the plugin and tried to use it, it would always show the text "ERROR" below it but I think the regex match work. This made the plugin unusable since people wouldn't know when/if they were typing in an error. However, I was able to fix it by doing a fresh install of jenkins through a build after downloading version 2.3 github repo.(NOTE version 2.4 doesn't work) wget https: //github.com/jenkinsci/validating-string-parameter-plugin/archive/validating-string-parameter-2.3.tar.gz #install maven mvn -X package #Uninstall the validating-string-parameter plugin + deleted the directory / var /lib/jenkins/plugins/validating-string-parameter #Manually uploaded the validating-string-parameter.hpi Pretty crazy workaround since I literally used the same code as in the plugin downloaded from jenkins but it seems the custom build and upload worked for some reason. I didn't see anything different in the jelly conf or java files so it's strange but this works. Hope this helps someone out since this parameter plugin is pretty essential.

              People

              • Assignee:
                petehayes Peter Hayes
                Reporter:
                christianlangmann Christian Langmann
              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: