[JIRA] (JENKINS-57186) New View href is an absolute URL but other menu items are relative URLs

12 views
Skip to first unread message

napoleon_blownapart@abms.net.au (JIRA)

unread,
Apr 26, 2019, 12:20:02 PM4/26/19
to jenkinsc...@googlegroups.com
Napoleon BlownApart updated an issue
 
Jenkins / Bug JENKINS-57186
New View href is an absolute URL but other menu items are relative URLs
Change By: Napoleon BlownApart
Summary: New View href does not include "${rootURL}/" is an absolute URL but other menu items are relative URLs
The href of the "New View" link in the left panel is constructed differently from the other links and is an absolute URL rather than a relative URL .   The sidepanel2.jelly file seems to be missing ${rootURL}/. 

 

I've only noticed this issue because our Jenkins server is setup behind a VPN & SSH, and we use two domain name variants to access Jenkins depending on whether the user is in the lab (thus using "jenkins.int") or outside the lab (thus using "jenkins.vpn").

The consequence of this is that when an external user accesses the Jenkins server via VPN/SSH
using "jenkins.vpn" , the "New View" link points to "jenkins.int/newView" instead of "jenkins.vpn/newView".  This means that external users get a 404 error (Server not found) and need to manually correct the url.  (Minor/trivial bug.)

 

 

 
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

napoleon_blownapart@abms.net.au (JIRA)

unread,
Apr 27, 2019, 12:25:02 AM4/27/19
to jenkinsc...@googlegroups.com
Napoleon BlownApart updated an issue
The href of the "New View" link in the left panel is constructed differently from the other links and is an absolute URL rather than a relative URL.

 

I've only noticed this issue because our Jenkins server is setup behind a VPN & SSH, and we use two domain name variants to access Jenkins depending on whether the user is in the lab (thus using "jenkins.int") or outside the lab (thus using "jenkins.vpn").

The consequence of this is that when an external user accesses the Jenkins server via VPN/SSH using "jenkins.vpn", the "New View" link points to "jenkins.int/newView" instead of "jenkins.vpn/newView".  This means that external users get a 404 error (Server not found) and need to manually correct the url.  (Minor/trivial bug.)

 

In core/src/main/java/jenkins/model/NewViewLink.java, starting line 45

 
{code:java}
@Override
public String getUrlName() {
    String urlName = Jenkins.getInstance().getRootUrl() + URL_NAME;
    return urlName;
}
{code}
the class prepends _Jenkins.getInstance().getRootUrl()_ to _URL_NAME_.
  If "/" is prepended instead, _urlName_ becomes a relative address, and the "New View" link is fixed.

As I am not familiar with the Jenkins codebase, I'm not sure if this is the right way to fix this problem.

 

 

napoleon_blownapart@abms.net.au (JIRA)

unread,
Apr 27, 2019, 12:26:02 AM4/27/19
to jenkinsc...@googlegroups.com
Napoleon BlownApart updated an issue
The href of the "New View" link in the left panel is constructed differently from the other links and is an absolute URL rather than a relative URL.

 

I've only noticed this issue because our Jenkins server is setup behind inside a VPN & SSH, .  So we VPN into the university and then SSH to our gateway machine.  Thus we use two domain name variants to access Jenkins depending on whether the user is in the lab (thus using "jenkins.int") or outside the lab (thus using "jenkins.vpn").


The consequence of this is that when an external user accesses the Jenkins server via VPN/SSH using "jenkins.vpn", the "New View" link points to "jenkins.int/newView" instead of "jenkins.vpn/newView".  This means that external users get a 404 error (Server not found) and need to manually correct the url.  (Minor/trivial bug.)

 

In core/src/main/java/jenkins/model/NewViewLink.java, starting line 45

 
{code:java}
@Override
public String getUrlName() {
    String urlName = Jenkins.getInstance().getRootUrl() + URL_NAME;
    return urlName;
}
{code}
the class prepends _Jenkins.getInstance().getRootUrl()_ to _URL_NAME_.  If "/" is prepended instead, _urlName_ becomes a relative address, and the "New View" link is fixed.

As I am not familiar with the Jenkins codebase, I'm not sure if this is the right way to fix this problem.

 

 

nisshah1499@gmail.com (JIRA)

unread,
May 8, 2019, 1:17:02 PM5/8/19
to jenkinsc...@googlegroups.com
Nisarg Shah commented on Bug JENKINS-57186
 
Re: New View href is an absolute URL but other menu items are relative URLs

Napoleon BlownApart I think that the solution you proposed would work.

Because making URL Relative would be a solution.

Oleg Nenashev What is your view?

nisshah1499@gmail.com (JIRA)

unread,
May 24, 2019, 10:20:02 AM5/24/19
to jenkinsc...@googlegroups.com

I tried applying the proposed solution, but few tests failed. So this solution won't work Napoleon BlownApart.

nisshah1499@gmail.com (JIRA)

unread,
May 24, 2019, 10:23:01 AM5/24/19
to jenkinsc...@googlegroups.com

Test Failures : 

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] FilePathTest.isDescendant_regularSymlinks:960
[ERROR] FilePathTest.isDescendant_worksEvenInSymbolicWorkspace:1110
[ERROR] UtilTest.resolveSymlinkToFile:570
[ERROR] NewViewLinkTest.getActionsHasPermission:55 expected:<https://127.0.0.1:8080/newView> but was:<[]/newView>
[ERROR] NewViewLinkTest.getActionsNoPermission:68 expected:<https://127.0.0.1:8080/newView> but was:<[]/newView>
[ERROR] VirtualFileTest.forFilePath_isDescendant:277->checkCommonAssertionForIsDescendant:312
[ERROR] VirtualFileTest.forFilePath_listOnlyDescendants_withoutIllegal:366->checkCommonAssertionForList:392
Expected: iterable over [Has name: aa, Has name: ab, Has name: _b] in any order
but: No item matches: Has name: _b in [<file:/C:/OpenSource/core/target/junit7334194361795927346/a/aa/>, <file:/C:/OpenSource/core/target/junit7334194361795927346/a/ab/>]
[ERROR] VirtualFileTest.forFile_isDescendant:261->checkCommonAssertionForIsDescendant:312
[ERROR] VirtualFileTest.forFile_listOnlyDescendants_withoutIllegal:351->checkCommonAssertionForList:392
Expected: iterable over [Has name: aa, Has name: ab, Has name: _b] in any order
but: No item matches: Has name: _b in [<file:/C:/OpenSource/core/target/junit2911051819889125610/a/aa/>, <file:/C:/OpenSource/core/target/junit2911051819889125610/a/ab/>]
[ERROR] Errors:
[ERROR] UtilTest.testIsSymlink_ParentIsSymlink:286 » FileSystem C:\OpenSource\core\tar...
[ERROR] AtomicFileWriterTest.symlinkToDirectory:80 » FileSystem C:\OpenSource\core\tar...
[ERROR] PathRemoverTest.testForceRemoveFile_ParentIsSymbolicLink:184 » FileSystem C:\O...
[ERROR] PathRemoverTest.testForceRemoveFile_SymbolicLink:153 » FileSystem C:\OpenSourc...
[ERROR] PathRemoverTest.testForceRemoveRecursive_ContainsSymbolicLinks:373 » FileSystem
[ERROR] PathRemoverTest.testForceRemoveRecursive_ParentIsSymbolicLink:411 » FileSystem
[INFO]
[ERROR] Tests run: 3712, Failures: 9, Errors: 6, Skipped: 28

nisshah1499@gmail.com (JIRA)

unread,
May 24, 2019, 10:34:03 AM5/24/19
to jenkinsc...@googlegroups.com
Nisarg Shah updated an issue
 
Change By: Nisarg Shah
Comment: I tried applying the proposed solution, but few tests failed. So this solution won't work [~nap].

nisshah1499@gmail.com (JIRA)

unread,
May 24, 2019, 10:34:04 AM5/24/19
to jenkinsc...@googlegroups.com
Nisarg Shah updated an issue
Change By: Nisarg Shah
Comment:
Test Failures : 

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] FilePathTest.isDescendant_regularSymlinks:960
[ERROR] FilePathTest.isDescendant_worksEvenInSymbolicWorkspace:1110
[ERROR] UtilTest.resolveSymlinkToFile:570
[ERROR] NewViewLinkTest.getActionsHasPermission:55 expected:<[https://127.0.0.1:8080]/newView> but was:<[]/newView>
[ERROR] NewViewLinkTest.getActionsNoPermission:68 expected:<[https://127.0.0.1:8080]/newView> but was:<[]/newView>

[ERROR] VirtualFileTest.forFilePath_isDescendant:277->checkCommonAssertionForIsDescendant:312
[ERROR] VirtualFileTest.forFilePath_listOnlyDescendants_withoutIllegal:366->checkCommonAssertionForList:392
Expected: iterable over [Has name: aa, Has name: ab, Has name: _b] in any order
but: No item matches: Has name: _b in [<file:/C:/OpenSource/core/target/junit7334194361795927346/a/aa/>, <file:/C:/OpenSource/core/target/junit7334194361795927346/a/ab/>]
[ERROR] VirtualFileTest.forFile_isDescendant:261->checkCommonAssertionForIsDescendant:312
[ERROR] VirtualFileTest.forFile_listOnlyDescendants_withoutIllegal:351->checkCommonAssertionForList:392
Expected: iterable over [Has name: aa, Has name: ab, Has name: _b] in any order
but: No item matches: Has name: _b in [<file:/C:/OpenSource/core/target/junit2911051819889125610/a/aa/>, <file:/C:/OpenSource/core/target/junit2911051819889125610/a/ab/>]
[ERROR] Errors:
[ERROR] UtilTest.testIsSymlink_ParentIsSymlink:286 » FileSystem C:\OpenSource\core\tar...
[ERROR] AtomicFileWriterTest.symlinkToDirectory:80 » FileSystem C:\OpenSource\core\tar...
[ERROR] PathRemoverTest.testForceRemoveFile_ParentIsSymbolicLink:184 » FileSystem C:\O...
[ERROR] PathRemoverTest.testForceRemoveFile_SymbolicLink:153 » FileSystem C:\OpenSourc...
[ERROR] PathRemoverTest.testForceRemoveRecursive_ContainsSymbolicLinks:373 » FileSystem
[ERROR] PathRemoverTest.testForceRemoveRecursive_ParentIsSymbolicLink:411 » FileSystem
[INFO]
[ERROR] Tests run: 3712, Failures: 9, Errors: 6, Skipped: 28
Reply all
Reply to author
Forward
0 new messages