Skip to content

Commit ae3f9aa

Browse files
authored
Resources / All resources are not images (geonetwork#5620)
Fix content type header when document is XML or XSD.
1 parent d280406 commit ae3f9aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/main/java/org/fao/geonet/resources/ResourceFilter.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.fao.geonet.kernel.setting.SettingManager;
3535
import org.fao.geonet.utils.Log;
3636
import org.springframework.context.ConfigurableApplicationContext;
37+
import org.springframework.http.MediaType;
3738
import org.springframework.web.context.request.ServletWebRequest;
3839

3940
import javax.servlet.*;
@@ -132,8 +133,11 @@ public void execute() throws IOException {
132133
return;
133134
}
134135

135-
// TODO : other type of resources html
136-
httpServletResponse.setContentType("image/" + ext);
136+
// Resources are images for logos, XML for map config or XSD
137+
httpServletResponse.setContentType(
138+
"xml".equals(ext) || "xsd".equals(ext)
139+
? MediaType.APPLICATION_XML_VALUE
140+
: "image/" + ext);
137141
httpServletResponse.addHeader("Cache-Control", "max-age=" + SIX_HOURS + ", public");
138142
if (filename.equals("images/logos/" + siteId + ".ico")) {
139143
favicon = resources.loadResource(resourcesDir, servletContext, appPath, "images/logos/" + siteId + ".ico", favicon.one(),

0 commit comments

Comments
 (0)