Issue Summary
On windows env, Automation Action "Execute Groovy script" is failing with the input validation error "Script file path must be absolute"
This is reproducible on Data Center: yes
This bug affects Jira Service Management Data Center installations with the bundled Assets/Insight since the Jira Service Management 4.20.14+.
This bug also affects the installations which do not come with the bundled Insight/Asset add-on, any Assets/Insight 8.10.13+ from the add-on marketplace listing.
Steps to Reproduce
- Create windows env
- Create an automation rule with Execute Groovy script action
- Provide the groovy script path and the system will not accept any format of the windows path
Expected Results
The correct windows file path must be accepted
Actual Results
Due to the below HTML input validation, the file path is being rejected
<input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" data-validations="{"^(?:(?!\\.\\.).)+$":"Script file path must be absolute","^\\/.+$":"Script file path must be absolute"}" value="" title="atm-rule-item-data-table-absFilePath">
Workaround
Option 1
- Open the Developer tool, edit the input field as HTML and remove the validation for saving the file path/rule temporarily. This needs to be done every time you require to save the path.
<input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" data-validations="{"^(?:(?!\\.\\.).)+$":"Script file path must be absolute","^\\/.+$":"Script file path must be absolute"}" value="" title="atm-rule-item-data-table-absFilePath">
TO
-
<input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" value="" title="atm-rule-item-data-table-absFilePath">
Option 2 (should be done carefully as it can break the insight jar)
These steps will remove the validation from the JS file itself
- Update ComponentDetailsEditView.js and redeploy insightx.xx.jar file
- Take a backup of insight-xxxx.jar(JIRA_INSTALL/atlassian-jira/WEB-INF/application-installation/jira-servicedesk-application) and copy it over to a different location
- extract the JS file
jar -xvf insight-xxx.jar includes/js/configure/automation/rule/configure/ComponentDetailsEditView.js
-
- Update the code below
556 const groovyPathError = AJS.I18n.getText("rlabs.insight.i18n.atm.rule.input.validation.error.groovyPath");
557 dataObjUIDef = {
558 'absFilePath' :
559 {
560 'inputType' : 'text',
561 'required' : true,
562 'i18nText' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.label"),
563 'description' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.description"),
564 'validations' : JSON.stringify({
565 [NO_PREV_FOLDER_PATTERN]: groovyPathError,
566 [MUST_START_WITH_SLASH_PATTERN]: groovyPathError
567 })
568 },
569 };
TO
-
556 const groovyPathError = AJS.I18n.getText("rlabs.insight.i18n.atm.rule.input.validation.error.groovyPath");
557 dataObjUIDef = {
558 'absFilePath' :
559 {
560 'inputType' : 'text',
561 'required' : true,
562 'i18nText' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.label"),
563 'description' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.description")
568 },
569 };
-
jar -uvf insight-xxxx.jar includes/js/configure/automation/rule/configure/ComponentDetailsEditView.js
-
- Stop Jira
- Replace the insight-xxxx.jar at JIRA_INSTALL/atlassian-jira/WEB-INF/application-installation/jira-servicedesk-application
- Replace the insight-xxxx.jar at JIRA_HOME/plugins/installed-plugins & JIRA_SHARED_HOME/plugins/installed-plugins as applicable
- Clear plugin cache folders .bundled-plugins & .osgi-plugins from both JIRA_HOME/plugins/installed-plugins & JIRA_SHARED_HOME/plugins/installed-plugins as applicable
- Start Jira