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

Core: PrimeFaces.resources.getFacesResource() RegExp issue #4850

melloware opened this issue May 30, 2019 · 0 comments


None yet
3 participants
Copy link

commented May 30, 2019

Found this error randomly in production.

var appUrl = pf.resources.getFacesResource('documentviewer/pdf.viewer.js', pfext.RESOURCE_LIBRARY, pfext.VERSION);

Because we use OmniFaces Resource Handler the URL can be something crazy like...

We noticed intermittently the getFacesResource was not generating the correct URL. Trace the bug to a Regular Expression problem. Because the above URL has a "js" in the middle of it it was not parsing correctly.

Current Regex:

var scriptRegex = new RegExp('\/?' + PrimeFaces.RESOURCE_IDENTIFIER + '(\/|=)(.*?)\.js');

Correct Regex to escape and capture correctly. using \

var scriptRegex = new RegExp('\\/?' + PrimeFaces.RESOURCE_IDENTIFIER + '(\\/|=)(.*?)\\.js');

Submitting a PR.

tandraschko added a commit that referenced this issue May 30, 2019

Merge pull request #4851 from melloware/PF4850
Fix #4850: Core getResourceScriptName RegExp escaping fix.

@tandraschko tandraschko added the defect label May 30, 2019

@tandraschko tandraschko added this to the 7.1 milestone May 30, 2019

@mertsincan mertsincan added the 7.0.4 label May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.