[FIXED HUDSON-2793] Fix from HUDSON-2379 introduced a bug for artifact/workspace

filenames with spaces.
- Added new Util.rawEncode which encodes the right set of characters (based on
  RFC1738) and deprecated Util.encode which only encodes non-ASCII.  Unit test too.
- Change previous fix to use Util.rawEncode instead of URLEncoder.encode
- New fix: add h.xmlEscape call for each displayed filename in artifacts/workspace
  so & and < are encoded for HTML display
- Add all these fixes in Run/artifacts-index.jelly which wasn't included before


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14355 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
mindless committed 2009-01-11 01:58:47 +00:00
1 parent cfa07b5024
commit 044c4ad122
7 files changed
+88 -25

No files matched your search

+17
View File
@@ -67,6 +67,23 @@ public class UtilTest extends TestCase {
assertEquals(encoded, "http://hudson/job/Hudson%20Job");
}
/**
* Test the rawEncode() method.
*/
public void testRawEncode() {
String[] data = { // Alternating raw,encoded
"abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"01234567890!@$&*()-_=+',.", "01234567890!@$&*()-_=+',.",
" \"#%/:;<>?", "%20%22%23%25%2F%3A%3B%3C%3E%3F",
"[\\]^`{|}~", "%5B%5C%5D%5E%60%7B%7C%7D%7E",
"d\u00E9velopp\u00E9s", "d%C3%A9%00velopp%C3%A9%00s",
};
for (int i = 0; i < data.length; i += 2) {
assertEquals("test " + i, data[i + 1], Util.rawEncode(data[i]));
}
}
/**
* Test the tryParseNumber() method.
*/