-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
any version of htmlpublisher-plugin, any current version of Jenkins
The visible Issue
In a build, I generate a report that contains Storybook ( https://storybook.js.org/ )
When I access the report, I see the page, but if I copy the URL and send it to a colleague, I get a 404.
Let's say for example the report is at : https://my-jenkins/myjob/master/report/index.html
The first time it's opened, Storybook replaces the URL with https://my-jenkins/myjob/master/report/index.html?path=/link_to_storybook_page/link_to_storybook_item
Now if I were to refresh the page (f5) or open it in a different window. I get a 404. Because I get redirected to https://my-jenkins/link_to_storybook_page/link_to_storybook_item
Why this happens
My first idea is that it was a storybook bug, but after ruling that out, I found that the HTMLPublisher Plugin, to serve the pages ( https://github.com/jenkinsci/htmlpublisher-plugin/blob/master/src/main/java/htmlpublisher/HtmlPublisherTarget.java#L270-L276 ) uses DirectoryBrowserSupport
And in DirectoryBrowserSupport There is a special condition that does a redirect if the path query parameter is present https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/DirectoryBrowserSupport.java#L190-L195
What can we do about it
Obviously that will be yours to decide, but here are my ideas
- Remove this legacy condition from DirectoryBrowserSupport
- Use something else than DirectoryBrowserSupport, I don't know the Jenkins internals, maybe there is another class that does a similar job without this bug
- Fork the class and maintain a version without this
- Ask Storybook if they can use a different routing mechanism (I create an issue for them as well)
Thanks in advance for your time