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

Should check scriptSrc for undefined along with null here. Otherwise SPScriptAudit breaks down. #82

Open
AKrasheninnikov opened this issue Dec 5, 2019 · 1 comment

Comments

@AKrasheninnikov
Copy link

AKrasheninnikov commented Dec 5, 2019

if (scriptSrc !== null && scriptSrc.length > 0 && !coreScript(scriptSrc)) {

The hyperlink referenced line checks scriptSrc variable to be not equal to null, but when it's undefined, it's not exactly null, and scriptSrc.length throws an Exception:

jquery.min.js:formatted:3981 Uncaught TypeError: Cannot read property 'length' of undefined
    at Object.success (jquery.SPServices-2014.02.js?_=1575556158629:3117)
    at j (jquery.min.js:formatted:1341)
    at Object.fireWith [as resolveWith] (jquery.min.js:formatted:1398)
    at x (jquery.min.js:formatted:4008)
    at b (jquery.min.js:formatted:4209)
    at Object.send (jquery.min.js:formatted:4212)
    at Function.ajax (jquery.min.js:formatted:3978)
    at SPScriptAuditPage (jquery.SPServices-2014.02.js?_=1575556158629:3104)
    at Element.<anonymous> (jquery.SPServices-2014.02.js?_=1575556158629:3081)
    at Function.each (jquery.min.js:formatted:167)

Encountered when calling

$().SPServices.SPScriptAudit({
auditForms:false, auditViews:false, outputId: "js-output", listName:'layout', showSrc:true
});

and a page such as PageNotFoundError.aspx contains an inline script without src.

@AKrasheninnikov
Copy link
Author

2019-12-05 17_54_54-Window

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

No branches or pull requests

1 participant