import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.security.Permission;
import java.util.ArrayList;
import java.util.Collections;
path = path.substring(contextPath.length());
}
}
+ path = URLDecoder.decode(path, "UTF-8");
object = context.lookup(path);
attributes = context.getAttributes(path);
if (object instanceof Resource)
// Reopen resource
try {
- resource = (Resource) context.lookup(getURL().getFile());
+ resource = (Resource) context.lookup(
+ URLDecoder.decode(getURL().getFile(), "UTF-8"));
} catch (NamingException e) {
// Ignore
}
context.list(file.substring(start));
while (enumeration.hasMoreElements()) {
NameClassPair ncp = enumeration.nextElement();
- result.addElement(ncp.getName());
+ result.addElement(
+ URLEncoder.encode(ncp.getName(), "UTF-8"));
}
} catch (NamingException e) {
// Unexpected exception
the current request thread name. Based on a patch from Felix Schumacher.
(timw)
</add>
+ <fix>
+ <bug>51584</bug>: Ensure file paths are encoded/decoded when translated
+ to/from URLs when working with resources from a Context so special
+ characters don't cause issues. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">