code: private MediaType findContentType(final String url) {
          if (url == null) {
              return null;
          }
  
          if (url.startsWith("file")) {
              return APPLICATION_OCTET_STREAM_TYPE;
          } else if (url.startsWith("http")) {
              try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
                  final HttpHead httpHead = new HttpHead(url);
                  try (CloseableHttpResponse response = httpClient.execute(httpHead)) {
                      if (response.getStatusLine().getStatusCode() == SC_OK) {
                          final Header contentType = response.getFirstHeader(CONTENT_TYPE);
                          if (contentType != null) {
                              return MediaType.valueOf(contentType.getValue());
                          }
                      }
                  }
              } catch (final IOException e) {
                  LOGGER.warn("Unable to retrieve external content from {} due to {}", url, e.getMessage());
              } catch (final Exception e) {
                  throw new RepositoryRuntimeException(e);
              }
          }
          LOGGER.debug("Defaulting to octet stream for media type");
          return APPLICATION_OCTET_STREAM_TYPE;
      }
docs: Find the content type for a remote resource
  @param url of remote resource
  @return the content type reported by remote system or "application/octet-stream" if not supplied