Skip to content

Commit

Permalink
[FIXED JENKINS-17317] ”My Views" links leads to 404 Not Found.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssogabe committed Apr 10, 2013
1 parent e1f070b commit d33e22d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -64,6 +64,9 @@
<li class=bug>
“Build Now” context menu item broken for parameterized jobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17110">issue 17110</a>)
<li class=bug>
”My Views" links leads to 404 Not Found.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17317">issue 17317</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/model/MyViewsProperty.java
Expand Up @@ -145,7 +145,7 @@ public View getPrimaryView() {
}

public HttpResponse doIndex() {
return new HttpRedirect("view/" + getPrimaryView().getViewName() + "/");
return new HttpRedirect("view/" + Util.encode(getPrimaryView().getViewName()) + "/");

This comment has been minimized.

Copy link
@jglick

jglick Apr 10, 2013

Member

What exactly does this accomplish? encode is not suitable for creating URLs as it does not escape general characters, only space (U+0020) and non-ASCII (U+0080–U+FFFF). encodeRFC2396 would probably do what you want (it is deprecated for no clear reason), as would rawEncode (I think).

This comment has been minimized.

Copy link
@ssogabe

ssogabe Apr 11, 2013

Author Member

getPrimaryView().getViewName() may be non-ASCII like "すべて" which means "All" in Japanese. If it returns non-ASCII, redirection fail. So we should encode it.
I used Util.encode because of encodeRFC2396 deprecated.But I think "rawEncode" is better.

}

public synchronized void doCreateView(StaplerRequest req, StaplerResponse rsp)
Expand Down Expand Up @@ -262,5 +262,5 @@ public String getUrlName() {
}

}

}

0 comments on commit d33e22d

Please sign in to comment.