Access to linked asset denied in v2



  • I've just migrated from jsreport 1 -> 2. In v1 I added a linked asset that points to highcharts installed via npm. My config file contains "assets": { "allowedFiles": "**/*.*" }

    In v2, reports that don't use highcharts seem to work, but when I try to run anything that references the asset, or even just click on the asset in jsreport studio, I get:

    Request to file /app/node_modules/highcharts/highcharts.js denied. Please allow it by setting config { "assets": { "allowedFiles": "**/foo.js" } }

    (in case it's relevant, the entire jsreport installation is in a folder called /app/ in the running container.)

    Any ideas why I might be seeing this?


  • administrators

    hmm the configuration format of extensions configuration changed a bit for v2, it was not possible for our migration step to automatically convert configuration files but it looks like all you need to do is change: "assets": { "allowedFiles": "**/*.*" } to extensions: { "assets": { "allowedFiles": "**/*.*" } }, here you can find a description about configuration for extensions in v2



  • Ah, thanks very much for this. I didn't catch it when reading over the migration notes. This change worked.



  • How is this configuration set up in an MVC controller using Local Reporting? I see a class AssetsConfiguration, but can't figure out how to get that to work in the .Configure syntax in C#. I don't see AssetsConfiguration as part of ExtensionsConfiguration or the main Configure class. Any help is much appreciated!



  • I have the exact same issue as @Brian-Norris, I didn't found anything like AssetsConfiguration on the docs or on the .net wrapper docs, Any help on this?, thanks in advance



  • This is one way to allow access to all modules and file system from within jsreport.

    new LocalReporting()
    .UseBinary(JsReportBinary.GetBinary())
    .Configure(cfg => cfg.AllowedLocalFilesAccess())
    

    This allows just assets access

    .Configure(cfg => {
      cfg.AssetsConfiguration = new AssetsConfiguration() { AllowedFiles = "**/*.*" };
      return cfg;
    })
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.