-
Type:
Suggestion
-
Resolution: Unresolved
-
None
-
Component/s: UI
-
None
-
0
-
1
Newlines in custom hook messages are currently not shown in pop up messages
Sample steps to illustrate the current behaviour:
- Launch a Bitbucket instance
- Install the plugin Adaptavist ScriptRunner for Bitbucket Server
- in Administration > ScriptRunner, go to "Pre Hooks"
- Create a "Custom Pre Hook" script and set the trigger to "branch-delete"
- Use the following script to throw a popup message during branch deletion
import com.atlassian.bitbucket.hook.repository.RepositoryHookResult RepositoryHookResult.rejected("Branch delete", "First line" + "\nSecond line"+ "\r\nThird line" + "\r\n\r\nFourth Line")
In this sample script, newlines were added
- Locate a repository and delete a branch from the UI
The newlines in the custom message are not shown and are being removed:
The JSON response from the DELETE <BITBUCKET_URL>/rest/branch-utils/latest/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/branches request shows the following:
{
"errors":
[
{
"context": null,
"message": "Branch 'test-branch' could not be deleted",
"exceptionName": "com.atlassian.bitbucket.hook.repository.RepositoryHookVetoedException",
"details":
[
"Branch delete\nFirst line\n\nSecond line\r\nThird line\r\n\r\nFourth Line"
],
"trigger":
{
"id": "branch-delete",
"abortOnFirstVeto": false
}
}
]
}
The "details" includes the newline chars (e.g. "\n")
But the newlines are removed in the pop up message (highlighted in green):