1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00

parser: Use catalogs with resource loader

This commit is contained in:
Nick Wellnhofer 2024-06-17 15:29:56 +02:00
parent 57004006ae
commit c5e9a5b2c9

View File

@ -2425,9 +2425,16 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
return(NULL);
if ((ctxt != NULL) && (ctxt->resourceLoader != NULL)) {
char *resource = NULL;
int flags = 0;
int code;
#ifdef LIBXML_CATALOGENABLED
resource = (char *) xmlResolveResourceFromCatalog(url, publicId, ctxt);
if (resource != NULL)
url = resource;
#endif
if ((ctxt->options & XML_PARSE_NO_UNZIP) == 0)
flags |= XML_INPUT_UNZIP;
if ((ctxt->options & XML_PARSE_NONET) == 0)
@ -2435,6 +2442,8 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
code = ctxt->resourceLoader(ctxt->resourceCtxt, url, publicId, type,
flags, &ret);
if (resource != NULL)
xmlFree(resource);
if (code != XML_ERR_OK) {
xmlCtxtErrIO(ctxt, code, url);
return(NULL);