From 9d4bbb4d0035be1e70a83509f2f633740b15fb27 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 21 Oct 2024 10:52:16 -0500 Subject: [PATCH] Partially revert "Issue 150: Fix discovered problems and update unit tests.". This reverts parts of the commit from 822cb2183cafec400903c72d2a440e5d614648d6 involving the mimetype. Strange problems showed up that are unexpected and did not show up when this branch was deployed and tested. ``` Failed to determine the content type: (URI=https://api-dev.library.tamu.edu/fcrepo/rest/0a/eb/00/7d/0aeb007d-68bc-4c31-bece-508112e6f9c7/q-and-kevin-saf_objects/3/pages/page_0/files/new%20image%20again.jpg : stream=image/jpeg) ``` --- .../edu/tamu/iiif/service/AbstractManifestService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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) {