mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-08 01:26:03 +00:00
[fixed] Perform RFC2396 style escape. I suppose the proper fix is to change the signature to return URI so that it works better with chaining (issue #1464)
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8281 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
cd486a0617
commit
55a287b9ad
3 files changed
+22
-2
No files matched your search
@@ -27,6 +27,8 @@ import java.io.Writer;
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -696,6 +698,23 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the URL by RFC 2396.
|
||||
*
|
||||
* I thought there's another spec that refers to UTF-8 as the encoding,
|
||||
* but don't remember it right now.
|
||||
*
|
||||
* @since 1.204
|
||||
*/
|
||||
public static String encodeRFC2396(String url) {
|
||||
try {
|
||||
return new URI(null,url,null).toASCIIString();
|
||||
} catch (URISyntaxException e) {
|
||||
LOGGER.warning("Failed to encode "+url); // could this ever happen?
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps with the error icon and the CSS class to render error message.
|
||||
* @since 1.173
|
||||
|
||||
Reference in new issue
Block a user