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

Regex pattern that injects createObject("roSGNode", "ODC") can cause certain roku apps to crash #75

Closed
AntonKostenko opened this issue Sep 15, 2023 · 2 comments · Fixed by #76

Comments

@AntonKostenko
Copy link

The regex pattern const pattern = /(\.show\(\))/gim; that injects createObject("roSGNode", "ODC") can cause unexpected injections in some scenarios.
I am currently working on a couple of Roku channels that set a string to showEventMessage = "example.show()".

When using the current pattern, this injects an additional unexpected createObject("roSGNode", "ODC") that looks like this:

showEventMessage = "example.show() : createObject("roSGNode", "ODC")"

The misplaced quotes cause compilation errors.
Unfortunately I am unable to modify the roku app but a workaround I found was changing the pattern to:

const pattern = /(\.show\(\))(?![\w"])/gim;

https://github.com/dlenroc/node-roku/blob/main/packages/odc/src/internal/injector.ts#L61

Would you consider publishing a new package that account for this scenario?

@dlenroc
Copy link
Owner

dlenroc commented Sep 16, 2023

Thanks @AntonKostenko for finding and reporting this case.

A fix for this case was added via #76 and became part of version 1.4.3.

In a future version I'll think about making the injection smarter (to take brightscript/xml into consideration) and optional (opt-in) in case of usage via appium

@AntonKostenko
Copy link
Author

Thank you @dlenroc for the fix. Also thank you for this repo. You have created a very interesting and strong tool for such a difficult platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants