Skip to content

Commit

Permalink
try to prevent doubling extension due to extension being in item name…
Browse files Browse the repository at this point in the history
… already
  • Loading branch information
JuicyDragon committed Aug 29, 2024
1 parent 55969fc commit e4c6745
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void setFromItem(Item item) {
* <code>{nuix_version}</code> - The Nuix version as defined in <code>NUIX_VERSION</code><br>
*/
public void setStandardValues(DateTime now) {
if(now == null) {
if (now == null) {
now = DateTime.now();
}
set("date_short", now.toString("YYYYMMdd"));
Expand Down Expand Up @@ -191,7 +191,7 @@ public String get(String key) {
}

/***
* Clears all currently associated place holders (keys and values)
* Clears all currently associated placeholders (keys and values)
*/
public void clear() {
placeholderData.clear();
Expand Down Expand Up @@ -264,6 +264,11 @@ public String resolveTemplatePath(String template) {
}
result = p.matcher(result).replaceAll(value);
}

// Attempt to prevent double assigned extension. Happens in scenario where item name already
// contains the extension and therefore {extension} in template effectively adds it a second time
result = result.replaceAll("([a-zA-Z0-9]+)\\.\\1$", "$1");

return result;
}

Expand Down

0 comments on commit e4c6745

Please sign in to comment.