more route drawing

This commit is contained in:
Christian Beutel
2024-04-23 16:11:49 +02:00
parent 8a3894106f
commit b3ed2b1098
10 changed files with 261 additions and 98 deletions

View File

@@ -7,13 +7,13 @@ import { ClientResponseError } from "pocketbase";
export async function PUT(event: RequestEvent) {
try {
const data = await event.request.blob();
const gpx = await data.text();
if (!gpx.length) {
const gpxString = await data.text();
if (!gpxString.length) {
throw new ClientResponseError({ status: 400, response: { message: "Empty file" } })
}
let trail: Trail;
try {
trail = await gpx2trail(gpx);
trail = (await gpx2trail(gpxString)).trail;
} catch (e: any) {
throw new ClientResponseError({ status: 400, response: { message: "Invalid GPX file" } })
}