Skip to content

Commit

Permalink
OAIPMH server / Remove non valid chars from the value to match the xs…
Browse files Browse the repository at this point in the history
…lt filename to apply
  • Loading branch information
josegar74 committed Jan 10, 2024
1 parent 726ba00 commit 89ee124
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/src/main/java/org/fao/geonet/kernel/oaipmh/Lib.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ public static Element transform(Path schemaDir, Element env, Element md, String
root.addContent(md);
root.addContent(env);

//--- remove any non letter, number, dot or dash character

String processedTargetFormat = targetFormat.replaceAll("[^a-zA-Z0-9.-]", "");

//--- do an XSL transformation

Path styleSheet = schemaDir.resolve("convert").resolve(targetFormat);
Path styleSheet = schemaDir.resolve("convert").resolve(processedTargetFormat);

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.

return Xml.transform(root, styleSheet);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public Element dispatch(
// Set the service name, used in OaiPmhDispatcher to build the oaiphm endpoint URL
serviceContext.setService("api/oaipmh");


return oaiPmhDispatcher.dispatch(oaiPmhParams, serviceContext);
}

Expand Down

0 comments on commit 89ee124

Please sign in to comment.