Skip to content
Permalink
Browse files
[JENKINS-37026] Fix to encode URL to attachments
  • Loading branch information
miyajan committed Jul 28, 2016
1 parent 60e1f8f commit a6341ac8d5812eb7dfcf03e8c7f5ea2e33b6883d
@@ -6,6 +6,8 @@
import hudson.tasks.test.TestObject;
import jenkins.model.Jenkins;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;

public class AttachmentTestAction extends TestAction {
@@ -60,4 +62,8 @@ public static boolean isImageFile(String filename) {
return filename.matches("(?i).+\\.(gif|jpe?g|png)$");
}

public static String getUrl(String filename) throws UnsupportedEncodingException {
return "attachments/" + URLEncoder.encode(filename, "UTF-8");
}

}
@@ -13,7 +13,7 @@
<td class="pane">
<a class="${it.isImageFile(attachment) ? 'gallery' : ''}"
title="${attachment}"
href="attachments/${attachment}">${attachment}</a>
href="${it.getUrl(attachment)}">${attachment}</a>
</td>
</tr>
</j:forEach>

0 comments on commit a6341ac

Please sign in to comment.