Skip to content

Commit ad2b37a

Browse files
committed
fix: default to infinite recursion for geojson (close #366)
1 parent 174b80d commit ad2b37a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/renderer/renderer.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ export class LeafletRenderer extends MarkdownRenderChild {
508508
);
509509
let arr = Array.isArray(f) ? f : [f];
510510
for (let path of arr) {
511-
var abstractFile, depth;
511+
let abstractFile, depth;
512512
({ abstractFile, path, depth } = this.filePathAndDepth(
513513
path,
514514
sub
@@ -902,12 +902,12 @@ export class LeafletRenderer extends MarkdownRenderChild {
902902
) {
903903
let files = new Set(markerFile);
904904

905-
var sub = this.sourcePath.substring(
905+
const sub = this.sourcePath.substring(
906906
0,
907907
this.sourcePath.lastIndexOf("/")
908908
);
909909
for (let path of markerFolder) {
910-
var abstractFile, depth;
910+
let abstractFile, depth;
911911
({ abstractFile, path, depth } = this.filePathAndDepth(
912912
path,
913913
sub
@@ -1318,10 +1318,9 @@ export class LeafletRenderer extends MarkdownRenderChild {
13181318

13191319
private filePathAndDepth(path: string, sub: string) {
13201320
if (path[0] == ".") {
1321-
var rest = path.substring(1);
1322-
path = sub + rest;
1321+
path = sub + path.substring(1);
13231322
}
1324-
var depth = 2;
1323+
let depth = path.endsWith("/") ? 2 : Infinity;
13251324
while (path.endsWith("/")) {
13261325
path = path.substring(0, path.length - 1);
13271326
++depth;
@@ -1381,7 +1380,11 @@ export class LeafletRenderer extends MarkdownRenderChild {
13811380
try {
13821381
convertedLatitude = Number(`${latitude}`?.split("%", 1)[0]);
13831382
} catch (error) {
1384-
new Notice(t("There was an error with the provided latitude. Using default."));
1383+
new Notice(
1384+
t(
1385+
"There was an error with the provided latitude. Using default."
1386+
)
1387+
);
13851388
}
13861389
if (!isNaN(convertedLatitude)) {
13871390
coords[0] = convertedLatitude;
@@ -1393,7 +1396,11 @@ export class LeafletRenderer extends MarkdownRenderChild {
13931396
try {
13941397
convertedLongitude = Number(`${longitude}`?.split("%", 1)[0]);
13951398
} catch (error) {
1396-
new Notice(t("There was an error with the provided longitude. Using default."));
1399+
new Notice(
1400+
t(
1401+
"There was an error with the provided longitude. Using default."
1402+
)
1403+
);
13971404
}
13981405
if (!isNaN(convertedLongitude)) {
13991406
coords[1] = convertedLongitude;

0 commit comments

Comments
 (0)