From a1679f6144a4e100cf37f6c4f49cdf71a81862ec Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 30 May 2024 15:52:01 -0400 Subject: [PATCH] Switch to using extension for mediaType detection --- omod/src/main/java/org/openmrs/module/spa/SpaController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omod/src/main/java/org/openmrs/module/spa/SpaController.java b/omod/src/main/java/org/openmrs/module/spa/SpaController.java index 2f97a91..76b16dd 100644 --- a/omod/src/main/java/org/openmrs/module/spa/SpaController.java +++ b/omod/src/main/java/org/openmrs/module/spa/SpaController.java @@ -49,7 +49,7 @@ public class SpaController { public ResponseEntity getStaticFileWithoutCacheHeaders(@PathVariable String filename) { FileSystemResource resource = (FileSystemResource) resourceLoader.getResource("/" + filename); if (resource.exists()) { - MediaType mediaType = filename.equalsIgnoreCase("service-worker") ? MediaType.parseMediaType("text/javascript") : MediaType.APPLICATION_JSON; + MediaType mediaType = filename.endsWith(".js") ? MediaType.parseMediaType("text/javascript") : MediaType.APPLICATION_JSON; return ResponseEntity.ok() .cacheControl(CacheControl.noCache().mustRevalidate())