allure2 icon indicating copy to clipboard operation
allure2 copied to clipboard

Spaces in folder name

Open taylor-benson opened this issue 3 years ago • 1 comments

Describe the bug When spaces are in the folder, and the allure:report is ran, the generated report path is quoted, but writing to the disk with an actual " for the first folder.

To Reproduce Steps to reproduce the behavior:

  1. Create a parent folder with space
  2. Check out source into folder with space
  3. Run allure report generation (ie mvn allure:report)
  4. View workspace, there will be a folder named "/

Expected behavior Folder should resolve without quotes, in this example it would go in target folder instead of creating "/workspace path/source/target/allure-results"

Screenshots image

Environment (please complete the following information):

Allure version 2.13.1 and higher
Test framework [email protected]
Allure adaptor [email protected]
Generate report using [email protected]

Additional context Versions 2.13.0 and below are not affected with this issue.

taylor-benson avatar May 14 '21 19:05 taylor-benson

Hello - I've run into this issue myself and did some investigation.

From what I can tell, this is actually an issue with the allure-maven repo. However, the problem didn't surface until the allure2 update from 2.13.0 to 2.13.1.

In that update, the JCommander dep went from version 2.72 to 2.78, which included a correction to their handling of quoted named parameters. In prior versions, named parameters were trimmed of surrounding double quotes, but this is no longer the case.

How this relates back to allure-maven is with the use of Apache's CommandLine in Commons Exec. This project has a longstanding bug, which causes added arguments that contain any spaces within it, to be surrounded with literal double quotes and passed through to the command launcher as such. This only occurs when the "handleQuote" flag is set, which is enabled by default. This is done in a few places within allure-maven, but in particular here.

So for the path mentioned in this issue: /workspace path/source/target/allure-results The mvn plugin would add this as an argument to the allure binary with the handleQuotes option set, causing it to be passed through as "/workspace path/source/target/allure-results" with literal quotes in the string and further processed by allure with JCommander, which no longer trims it.

A simple solution to this that I could think would be to pass false to the "handleQuotes" option in the allure-maven project when adding arguments to CommandLine and it doesn't seem to have any negative side effects. I did a quick check on unix-like and windows systems, with and without spaces, and it seems to work. Although, I'm not so sure about some more potentially obscure paths.

dvargas46 avatar Nov 08 '22 02:11 dvargas46