dojo-config cacheBust causing 404 on esri/symbols/SimpleFillSymbol

5222
4
04-29-2015 06:59 AM
MatthewGarrod
New Contributor II

When using cacheBust in dojo and adding a SimpleFillSymbol with a style of SimpleFillSymbol.STYLE_DIAGONAL_CROSS on a graphic, the request adds the cacheBust param in the wrong place of the URL and the image can not be found:

http://js.arcgis.com/3.13/esri/images/symbol/sfs/?1430314495556diagonalcross.png

new SimpleLineSymbol(SimpleLineSymbol

Sample code:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }
      body {
        background-color: #FFF;
        overflow: hidden;
        font-family: "Trebuchet MS";
      }
    </style>
    <script src="http://js.arcgis.com/3.13/" data-dojo-config="cacheBust:true"></script>
    <script>
      var map;


      require(["esri/map", "esri/toolbars/draw", "esri/graphic", "esri/symbols/SimpleLineSymbol",
        "esri/symbols/SimpleFillSymbol", "dojo/_base/Color", "dojo/domReady!"], function(Map, Draw, Graphic, SimpleLineSymbol, SimpleFillSymbol, Color) {
        map = new Map("map", {
          basemap: "topo",  //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
          center: [-122.45, 37.75], // longitude, latitude
          zoom: 13
        });
          
        toolbar = new Draw(map);
        toolbar.on("draw-end", addToMap);
        toolbar.activate(Draw['POLYGON']);
          
        function addToMap(evt) {
          toolbar.deactivate();
          
          var symbol = new SimpleFillSymbol(
                SimpleFillSymbol.STYLE_DIAGONAL_CROSS, //STYLE_NULL, 
                new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASH, new Color([255,0,255]), 3), 
                new Color([255,0,255,1])
            );
          
          var graphic = new Graphic(evt.geometry, symbol);
          map.graphics.add(graphic);
        }
          
      });
    </script>
  </head>


  <body>
    <div id="map"></div>
  </body>
</html>
Tags (1)
4 Replies
KellyHutchins
Esri Frequent Contributor

Sounds like it might be a bug. Have you reported this issue to Esri support?

0 Kudos
MatthewGarrod
New Contributor II

Thanks Kelly for the response. I just submitted a support request.

PavelVeselský1
New Contributor III

Was it solved in the year since then? Seems not, since I face the same problem now (JS API 3.15, WAB 1.4).
If not, I'll have to search for a workaround.

0 Kudos
PavelVeselský1
New Contributor III

Solved!

The reason was the querystring assigned too early, to a base URL to which the filenames are added later. So the solution would be to find where are the filenames added and make this process querystring-aware by a code similar to this one:

if (widgetJson.folderUrl.indexOf("?") > -1) {
  url
= widgetJson.folderUrl.substr(0, widgetJson.folderUrl.indexOf("?")) + 'manifest.json' + widgetJson.folderUrl.substr(widgetJson.folderUrl.indexOf("?"));
} else {
  
//this is how it looked before
  url
= widgetJson.folderUrl + 'manifest.json';
}

Kelly Hutchins​: what should I do to propose this as a bugfix to the official version? In my case the bug might have been caused by my adaptation to non-standard paths due to inclusion in Orchard CMS, but I doubt that it couldn't happen in the standard version at all. If others will face the bug too, my solution should be included. The only alternative I can see is tweaking Dojo or at least JS API.