Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLFormatter with Windows and feature names beginning with 'x' #375

Closed
j-mccloskey opened this issue Aug 15, 2012 · 1 comment
Closed

Comments

@j-mccloskey
Copy link

Hi,

I've noticed that if I have a feature or folder beginning with the character 'x' when I try to view a html report generated on Windows nothing is displayed.

I've narrowed the problem down to be in the generation of report.js. When using Ubuntu or OS X the file separator is '/' and in the report.js there is the following for example:

formatter.uri('MavenCucumber**/**xHelloWorld.feature');

The html report displays fine. Switch over to Windows and the file separator of '' results in following ending up in report.js

formatter.uri('MavenCucumber**\x**HelloWorld.feature');

Leaving the index.html displaying a blank page. It seems to be treating the "\x" as an escape sequence for URIs leading to a malformed URI exception in the browser.I also found a Stack Overflow post of someone having a similar problem with the 'u' character.

By the time writeToJsReport is called the parameter 'arg' already has the file separator for the given OS in the string so to quickly check that the backslashes are really the problem I modified the method to look like this:

private void writeToJsReport(String functionName, String arg) {
    if(arg.contains(".feature")){
        arg = arg.replace('\\','/');
    }
    jsOut().append(JS_FORMATTER_VAR + ".").append(functionName).append("(").append(arg).append(");").println();
}

And as a result the html report displays correctly on Windows. There is probably a better place to fix this though.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants