Issue Summary
This is reproducible on Data Center: yes
Steps to Reproduce
- Edit a file using the edit file endpoint using a repo HTTP access token
Sample curl request below:
$ curl --location --request PUT 'http://localhost:7990/bitbucket/rest/api/latest/projects/PROJECT_1/repos/rep_1/browse/add_file/add_file.txt' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer MY REPO ACCESS TOKEN' \ --form 'content=@"add/add_file.txt"' \ --form 'message="Yet another change"' \ --form 'branch="thenewbranch1"' \ --form 'sourceCommitId="148a6f1a86d8d9316fb83bc9ef6ea473cf04bbb2"' \ --form 'sourceBranch="master"'
Expected Results
The new branch is created and a 200 status code is returned. A 4xx error code is returned indicating that project/repo tokens can't be used to make commits because they have no associated user.
Actual Results
The below exception is thrown in the mesh log file and a 500 is returned.
java.lang.IllegalArgumentException: A non-blank value is required at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.notBlank(DefaultGitProcessBuilder.java:1095) at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.withEnvironment(DefaultGitProcessBuilder.java:810) at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.author(DefaultGitProcessBuilder.java:282) at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.author(DefaultGitProcessBuilder.java:135) at com.atlassian.bitbucket.mesh.git.builder.AbstractGitProcessBuilder.author(AbstractGitProcessBuilder.java:81) at com.atlassian.bitbucket.mesh.git.builder.GitProcessBuilderSupport.author(GitProcessBuilderSupport.java:79) at com.atlassian.bitbucket.mesh.git.file.DefaultEditFileManager.commit(DefaultEditFileManager.java:167) at com.atlassian.bitbucket.mesh.git.file.DefaultEditFileManager.editFile(DefaultEditFileManager.java:107)
Workaround
Use a personal HTTP access token, or another authentication method for the REST call.
- relates to
-
BSERV-18835 In Bitbucket 8.x, when a user without an email address edits a file through the in-browser editor, an error is shown instead of a user-friendly message
- Closed