diff --git a/Logic/Osm/OsmConnection.ts b/Logic/Osm/OsmConnection.ts index 93164ca2f4..5b8408583a 100644 --- a/Logic/Osm/OsmConnection.ts +++ b/Logic/Osm/OsmConnection.ts @@ -1,4 +1,3 @@ -// @ts-ignore import osmAuth from "osm-auth"; import {UIEventSource} from "../UIEventSource"; import {OsmPreferences} from "./OsmPreferences"; @@ -222,7 +221,7 @@ export class OsmConnection { }); } - public closeNote(id: number | string, text?: string): Promise { + public closeNote(id: number | string, text?: string): Promise { let textSuffix = "" if ((text ?? "") !== "") { textSuffix = "?text=" + encodeURIComponent(text) @@ -249,7 +248,7 @@ export class OsmConnection { } - public reopenNote(id: number | string, text?: string): Promise { + public reopenNote(id: number | string, text?: string): Promise { if (this._dryRun.data) { console.warn("Dryrun enabled - not actually reopening note ", id, " with text ", text) return new Promise((ok, error) => { @@ -313,7 +312,7 @@ export class OsmConnection { } - public addCommentToNode(id: number | string, text: string): Promise { + public addCommentToNode(id: number | string, text: string): Promise { if (this._dryRun.data) { console.warn("Dryrun enabled - not actually adding comment ", text, "to note ", id) return new Promise((ok, error) => { diff --git a/Logic/Osm/OsmObject.ts b/Logic/Osm/OsmObject.ts index bb5a8e9972..f0ab35407a 100644 --- a/Logic/Osm/OsmObject.ts +++ b/Logic/Osm/OsmObject.ts @@ -69,7 +69,7 @@ export abstract class OsmObject { return rawData.elements[0].tags } - static async DownloadObjectAsync(id: string): Promise { + static async DownloadObjectAsync(id: string): Promise { const splitted = id.split("/"); const type = splitted[0]; const idN = Number(splitted[1]); @@ -80,6 +80,9 @@ export abstract class OsmObject { const full = (id.startsWith("way")) ? "/full" : ""; const url = `${OsmObject.backendURL}api/0.6/${id}${full}`; const rawData = await Utils.downloadJsonCached(url, 1000) + if(rawData === undefined){ + return undefined + } // A full query might contain more then just the requested object (e.g. nodes that are part of a way, where we only want the way) const parsed = OsmObject.ParseObjects(rawData.elements); // Lets fetch the object we need diff --git a/Logic/Osm/Overpass.ts b/Logic/Osm/Overpass.ts index 5463770acd..9845055b9b 100644 --- a/Logic/Osm/Overpass.ts +++ b/Logic/Osm/Overpass.ts @@ -4,8 +4,6 @@ import {Utils} from "../../Utils"; import {UIEventSource} from "../UIEventSource"; import {BBox} from "../BBox"; import * as osmtogeojson from "osmtogeojson"; -// @ts-ignore -import {Tag} from "../Tags/Tag"; // used in doctest /** * Interfaces overpass to get all the latest data