code: private String unexternalizeImageRef(String ref) {
      String unexternalizedRef = ref;
  
      if (StringUtils.isNotEmpty(unexternalizedRef)) {
  
        // decode if required
        unexternalizedRef = decodeIfEncoded(unexternalizedRef);
  
        // TODO: implementation has to be aligned with MediaSource implementations!
        // remove default servlet extension that is needed for inline images in RTE
        unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/" + JcrConstants.JCR_CONTENT + ".default");
        unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/_jcr_content.default");
      }
  
      return unexternalizedRef;
    }
docs: Converts the RTE externalized form of media reference to internal form.
  @param ref Externalize media reference
  @return Internal media reference