INTERACT FORUM

More => Old Versions => JRiver Media Center 27 for Windows => Topic started by: zybex on January 22, 2021, 03:26:35 am

Title: Expression gives different results on UI versus API
Post by: zybex on January 22, 2021, 03:26:35 am
The API function GetFilledTemplate() seems to add an extra call to Clean() before returning the output. This causes the output to be different from expected, and different from what the same expression yields on MC's UI.

Examples:
file.GetFilledTemplate("test")      = "test"  (correct)
file.GetFilledTemplate(":test")     = ":test" (correct)
file.GetFilledTemplate(": test")    = "test"  (wrong)
file.GetFilledTemplate("test()")    = "test"  (wrong)

Simply outputting any field/value that contains () is also mangled:
Code: [Select]
save(/#test(), (), test2()#/, v_test)
[v_test]

This outputs "test, , test2" when using the API, and "test(), (), test2()" when using an Expression column on MC.

Can you please check and make the API return the same as the UI?
Thanks!

(PS: this issue was discussed here: https://yabb.jriver.com/interact/index.php/topic,125975.msg888913.html#msg888913)
Title: Re: Expression gives different results on UI versus API
Post by: Matt on January 22, 2021, 08:00:35 am
I just tried this URL:
http://localhost:52199/MCWS/v1/File/GetFilledTemplate?File=53728241&FileType=Key&Expression=%22:%20test%22

And I get:
<Response Status="OK">
<Item Name="Value">": test"</Item>
</Response>

Is this only the GetFilledTemplate(...) API function?

Thanks.
Title: Re: Expression gives different results on UI versus API
Post by: Matt on January 22, 2021, 08:08:10 am
You're right that API calls add this:
JRString::CleanFilledTemplate(strValue);

Not sure why.  Let me dig a while.
Title: Re: Expression gives different results on UI versus API
Post by: Matt on January 22, 2021, 08:17:51 am
I'll remove it from the next build.  Here's the history:
Fixed: Getting an expression with the API could perform extra (and unwanted) cleaning of the output.

Thanks for helping find this!
Title: Re: Expression gives different results on UI versus API
Post by: zybex on January 22, 2021, 10:49:43 am
Thanks Matt! And props to Wer too, he bumped onto the issue on his first Zelda try :)