Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function handler parameter mapping splitting inputs which include colon character #305

Closed
mshangle1 opened this issue Nov 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mshangle1
Copy link
Contributor

Describe the bug
When providing parameters to function mapping (ie: $F{sum:1,2}), if the parameter includes a : character, the rest of the parameter is cut off from being included in the arguments.

I am trying to create a function which will allow to give some ISO DateTime format to the method and generate a DateTime with the given format.

To Reproduce
Steps to reproduce the behavior:
Example: $F{CurrentDate:yyyy-MM-dd'T'HH:mm:ss}

Function:
function currentDate(ctx){ some code here }

Adding Function Handler:
handler.addDataFuncHandler('CurrentDate', (ctx) => {return currentDate(ctx)})

When reaching the function, the only value included in ctx.args[0] is yyyy-MM-dd'T'HH which is cutting off the mm and ss parts of the ISO format.

Expected behavior
The expected behavior in my case would be to allow the function args/parameters to include the : character and not be split when processing the input.

Potential Solution
In dataProcessor.js line 104, the FunctionName:param1,param2 string is being split up by the : character for all instances of the character, causing arguments which include a : to be split and not passed to the function when it is filtered out on line 106.

I was able to reach expected behavior by modifying the refValue.split(':') on line 104 to use a regex expression to only split by the first instance of the : character like so refValue.split(/:(.*)/)

If there is already some way to allow arguments to include the : character without any changes please let me know. Otherwise I think a change would be required to allow it.

@ASaiAnudeep ASaiAnudeep added the bug Something isn't working label Dec 20, 2023
@ASaiAnudeep
Copy link
Member

ASaiAnudeep commented Dec 20, 2023

@mshangle1 If you are able to address the issue, please submit a pull request with the necessary fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants