[JIRA] (JENKINS-61095) HTML Published pages redirect to a broken url if "path=" is included in a query parameter

2 views
Skip to first unread message

onigoetz@onigoetz.ch (JIRA)

unread,
Feb 14, 2020, 7:31:02 AM2/14/20
to jenkinsc...@googlegroups.com
Stéphane Goetz created an issue
 
Jenkins / Bug JENKINS-61095
HTML Published pages redirect to a broken url if "path=" is included in a query parameter
Issue Type: Bug Bug
Assignee: Richard Bywater
Components: htmlpublisher-plugin
Created: 2020-02-14 12:30
Environment: any version of htmlpublisher-plugin, any current version of Jenkins
Priority: Minor Minor
Reporter: Stéphane Goetz

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, it breaks.

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

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

onigoetz@onigoetz.ch (JIRA)

unread,
Feb 14, 2020, 7:32:02 AM2/14/20
to jenkinsc...@googlegroups.com
Stéphane Goetz updated an issue
Change By: Stéphane Goetz
*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, it breaks 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
Reply all
Reply to author
Forward
0 new messages