diff --git a/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java b/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java index 2d59e878..3bbf2a06 100644 --- a/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java +++ b/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java @@ -477,13 +477,12 @@ protected Optional getImageInfo(String url) { } protected Optional getMimeType(String url) { - HttpHeaders headers = restTemplate.headForHeaders(url); - - if (headers == null) { + try { + HttpHeaders headers = restTemplate.headForHeaders(url); + return Optional.ofNullable(headers.getFirst(HttpHeaders.CONTENT_TYPE)); + } catch (RestClientException e) { return Optional.empty(); } - - return Optional.ofNullable(headers.getFirst(HttpHeaders.CONTENT_TYPE)); } private Metadata buildMetadata(String label, String value) {