Refactoring
This commit is contained in:
parent
9e75c2c1c4
commit
bf592ab102
1 changed files with 5 additions and 3 deletions
|
|
@ -279,7 +279,9 @@ const extractMarkersFromQuery = (query, options, transformer) => {
|
||||||
let iconURI = markerParts[1];
|
let iconURI = markerParts[1];
|
||||||
// Check if icon is served via http otherwise marker icons are expected to
|
// Check if icon is served via http otherwise marker icons are expected to
|
||||||
// be provided as filepaths relative to configured icon path
|
// be provided as filepaths relative to configured icon path
|
||||||
if (!(iconURI.startsWith('http://') || iconURI.startsWith('https://') || iconURI.startsWith('data:'))) {
|
const isRemoteURL = iconURI.startsWith('http://') || iconURI.startsWith('https://');
|
||||||
|
const isDataURL = iconURI.startsWith('data:');
|
||||||
|
if (!(isRemoteURL || isDataURL)) {
|
||||||
// Sanitize URI with sanitize-filename
|
// Sanitize URI with sanitize-filename
|
||||||
// https://www.npmjs.com/package/sanitize-filename#details
|
// https://www.npmjs.com/package/sanitize-filename#details
|
||||||
iconURI = sanitize(iconURI);
|
iconURI = sanitize(iconURI);
|
||||||
|
|
@ -292,9 +294,9 @@ const extractMarkersFromQuery = (query, options, transformer) => {
|
||||||
iconURI = path.resolve(options.paths.icons, iconURI);
|
iconURI = path.resolve(options.paths.icons, iconURI);
|
||||||
|
|
||||||
// When we encounter a remote icon check if the configuration explicitly allows them.
|
// When we encounter a remote icon check if the configuration explicitly allows them.
|
||||||
} else if (options.allowRemoteMarkerIcons !== true) {
|
} else if (isRemoteURL && options.allowRemoteMarkerIcons !== true) {
|
||||||
continue;
|
continue;
|
||||||
} else if (options.allowInlineMarkerImages !== true) {
|
} else if (isDataURL && options.allowInlineMarkerImages !== true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue