Whitelist extension if present in the request mapping
We know skip the Content-Disposition header for any extension if the chosen request mapping explicitly contains the URl extension. Issue: SPR-13629
This commit is contained in:
@@ -375,13 +375,12 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
if (this.safeExtensions.contains(extension)) {
|
||||
return true;
|
||||
}
|
||||
String pattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
|
||||
if (pattern != null && pattern.endsWith("." + extension)) {
|
||||
return true;
|
||||
}
|
||||
if (extension.equals("html")) {
|
||||
String name = HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE;
|
||||
String pattern = (String) request.getAttribute(name);
|
||||
if (pattern != null && pattern.endsWith(".html")) {
|
||||
return true;
|
||||
}
|
||||
name = HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE;
|
||||
String name = HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE;
|
||||
Set<MediaType> mediaTypes = (Set<MediaType>) request.getAttribute(name);
|
||||
if (!CollectionUtils.isEmpty(mediaTypes) && mediaTypes.contains(MediaType.TEXT_HTML)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user