mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-15 10:20:47 +00:00
As part of fix for [HER-1671] WARCWriterProcessor error when writing problematic (illegal control character?) outlink - percent encode control-characters in 'userinfo' part of URI as we do for uriPath and uriQuery, so we don't raise exception when adding outlinks to metadata record
* UURIFactory.java ensureMinimalEscaping() on 'userinfo' in UURIFactory.fixupAuthority()
This commit is contained in:
1 parent
677a816db4
commit
03df2a9a99
1 file changed
+4
-4
@@ -466,7 +466,7 @@ public class UURIFactory extends URI {
|
||||
|
||||
// fixup authority portion: lowercase/IDN-punycode any domain;
|
||||
// remove stray trailing spaces
|
||||
uriAuthority = fixupAuthority(uriAuthority);
|
||||
uriAuthority = fixupAuthority(uriAuthority,charset);
|
||||
|
||||
// Do some checks if absolute path.
|
||||
if (uriSchemeSpecificPart != null &&
|
||||
@@ -586,7 +586,7 @@ public class UURIFactory extends URI {
|
||||
* @return fixed version
|
||||
* @throws URIException
|
||||
*/
|
||||
private String fixupAuthority(String uriAuthority) throws URIException {
|
||||
private String fixupAuthority(String uriAuthority, String charset) throws URIException {
|
||||
// Lowercase the host part of the uriAuthority; don't destroy any
|
||||
// userinfo capitalizations. Make sure no illegal characters in
|
||||
// domainlabel substring of the uri authority.
|
||||
@@ -612,12 +612,12 @@ public class UURIFactory extends URI {
|
||||
return domain + port;
|
||||
} else if (atIndex>-1 && portColonIndex<0) {
|
||||
// uncommon: userinfo, no port
|
||||
String userinfo = uriAuthority.substring(0,atIndex+1);
|
||||
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
|
||||
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1));
|
||||
return userinfo + domain;
|
||||
} else {
|
||||
// uncommon: userinfo, port
|
||||
String userinfo = uriAuthority.substring(0,atIndex+1);
|
||||
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
|
||||
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1,portColonIndex));
|
||||
String port = uriAuthority.substring(portColonIndex);
|
||||
return userinfo + domain + port;
|
||||
|
||||
Reference in new issue
Block a user