File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import L from "./global/leaflet" ;
2
+
3
+ let protocolRegex = / ^ \/ \/ / ;
4
+ let upgrade_protocol = function ( urlTemplate ) {
5
+ if ( protocolRegex . test ( urlTemplate ) ) {
6
+ if ( window . location . protocol === "file:" ) {
7
+ // if in a local file, support http
8
+ // http should auto upgrade if necessary
9
+ urlTemplate = "http:" + urlTemplate ;
10
+ }
11
+ }
12
+ return urlTemplate ;
13
+ } ;
14
+
15
+ let originalLTileLayerInitialize = L . TileLayer . prototype . initialize ;
16
+ L . TileLayer . prototype . initialize = function ( urlTemplate , options ) {
17
+ urlTemplate = upgrade_protocol ( urlTemplate ) ;
18
+ originalLTileLayerInitialize . call ( this , urlTemplate , options ) ;
19
+ } ;
20
+
21
+ let originalLTileLayerWMSInitialize = L . TileLayer . WMS . prototype . initialize ;
22
+ L . TileLayer . WMS . prototype . initialize = function ( urlTemplate , options ) {
23
+ urlTemplate = upgrade_protocol ( urlTemplate ) ;
24
+ originalLTileLayerWMSInitialize . call ( this , urlTemplate , options ) ;
25
+ } ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import defaultMethods from "./methods";
13
13
14
14
import "./fixup-default-icon" ;
15
15
import "./fixup-default-tooltip" ;
16
+ import "./fixup-url-protocol" ;
16
17
17
18
import DataFrame from "./dataframe" ;
18
19
import ClusterLayerStore from "./cluster-layer-store" ;
You can’t perform that action at this time.
0 commit comments