-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Zach Legein opened SPR-5112 and commented
A url like this will cause an error:
http://www.website.com/test.html?file=/path/to/file
My suggestion would be to do something like this:
int begin = urlPath.indexOf("://");
if (begin == -1) {
return null;
}
String body = urlPath.substring(begin + "://".length(), urlPath.length());
if (!body.contains("/")) {
return null;
}
int end = urlPath.indexOf('?');
if (end == -1) {
end = urlPath.length();
}
String url = urlPath.substring(0, end);
begin = url.lastIndexOf("/") + 1;
String filename = url.substring(begin, url.length());
int dotIndex = filename.lastIndexOf('.');
if (dotIndex != -1) {
filename = filename.substring(0, dotIndex);
}
return filename;
Affects: 2.5.5
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug