Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
boonboonsiri committed Oct 10, 2023
1 parent f33577b commit bdc7a3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/serve_rendered.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ const extractMarkersFromQuery = (query, options, transformer) => {
let iconURI = markerParts[1];
// Check if icon is served via http otherwise marker icons are expected to
// 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
// https://www.npmjs.com/package/sanitize-filename#details
iconURI = sanitize(iconURI);
Expand All @@ -292,9 +294,9 @@ const extractMarkersFromQuery = (query, options, transformer) => {
iconURI = path.resolve(options.paths.icons, iconURI);

// 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;
} else if (options.allowInlineMarkerImages !== true) {
} else if (isDataURL && options.allowInlineMarkerImages !== true) {
continue;
}

Expand Down

0 comments on commit bdc7a3f

Please sign in to comment.