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

'Invalid character' client errors #454

Open
dahlbyk opened this issue Jul 16, 2014 · 1 comment
Open

'Invalid character' client errors #454

dahlbyk opened this issue Jul 16, 2014 · 1 comment

Comments

@dahlbyk
Copy link

dahlbyk commented Jul 16, 2014

I can't reproduce on any of my machines (of course), but our production JS error reporting shows a bunch like this, for a variety of browsers:

UncaughtException: Invalid character
    at http://example.com/cassette.axd/script/8fa1005870134091d6c3a11981ce9daafdb0dfa1/content/js/whatever.js:1

Similar errors include:

  • UncaughtException: SyntaxError: Invalid character '\u0031'
  • UncaughtException: SyntaxError: illegal character

What's interesting is that I haven't seen this error for any of the bundled scripts, only for individual scripts configured like so:

    public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
    {
        private const string jsBase = "content/js/";
        private const string cssBase = "content/css/";

        private static readonly FileSearch fileSearch = new FileSearch
        {
            SearchOption = SearchOption.AllDirectories,
        };

        public void Configure(BundleCollection bundles)
        {
            bundles.AddPerIndividualFile<StylesheetBundle>(cssBase, fileSearch);
            bundles.AddPerIndividualFile<ScriptBundle>(jsBase, fileSearch);

            // init bundles...
        }
    }

    public static class AppHelper
    {
        public static string JsUrl(string jsFile)
        {
            return Bundles.Url<ScriptBundle>("/content/js/" + jsFile);
        }
    }

The scripts are pulled into the view with:

<script type="text/javascript" src="<%= AppHelper.JsUrl("whatever.js") %>"></script>">

Has anyone seen this?

@dahlbyk
Copy link
Author

dahlbyk commented Jul 16, 2014

Worth a thousand words:
image

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