wanderer icon indicating copy to clipboard operation
wanderer copied to clipboard

Auto-upload does not work for some GPX files

Open WetenSchaap opened this issue 1 year ago • 4 comments

Presumably related to #56.

Some of my gpx files (example here, same as mentioned in #56) are not uploaded automatically from the auto-upload folder. When I run the job manually I get the following error message:

/app/uploads/9-la-sage-to-cabane-moiry.gpx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6820  100   486  100  6334  46565   592k --:--:-- --:--:-- --:--:--  666k
{
  "url":"http://db:8090/api/collections/trails/records",
  "status":400,
  "response":{
    "code":400,
    "message":"Failed to create record.",
    "data":{
      "name":{
        "code":"validation_required",
        "message":"Missing required value."
  }}},
  "isAbort":false,
  "originalError":{
    "url":"http://db:8090/api/collections/trails/records",
    "status":400,
    "data":{
      "code":400,
      "message":
      "Failed to create record.",
      "data":{
        "name":{
          "code":"validation_required",
          "message":"Missing required value."
  }}}},
  "name":"ClientResponseError 400"
}

Other GPX-files do get uploaded as expected, so it probably has something to do with the <rte> tag again?

WetenSchaap avatar May 09 '24 10:05 WetenSchaap

After some testing, I can say that this issue is unrelated to #56. The error occurs because the trail has no name tag in the metadata section. wanderer parses this section to determine the trail name when uploading through the API. If the trail name is empty PocketBase rejects the insert attempt as the name field is required for a trail entry.

The trail you provided as an example has a name, so it uploads without problems in my tests.

Flomp avatar May 09 '24 13:05 Flomp

You are absolutely right, the example file was actually the only file in a group that did upload correctly - oops. The others do have a name, but defined outside the metadata section: see correct example here.

At any rate, just erroring out because a track has no name may not be the right way to go? Maybe a fallback to the file name is a better strategy?

WetenSchaap avatar May 09 '24 14:05 WetenSchaap

I agree. Trails without a name will get a generic "trail-<ISO-Timestamp>" name in the next patch. I won't take names outside of the metadata tag into account as they are not part of the official GPX specs.

Flomp avatar May 09 '24 14:05 Flomp

I won't take names outside of the metadata tag into account as they are not part of the official GPX specs.

That makes complete sense, probably better to keep Pandora's box firmly closed.

Thanks for the great work, it is really appreciated! :+1:

WetenSchaap avatar May 09 '24 16:05 WetenSchaap

I think something changed in a version prior to 0.5.1. I don't know which version I was running when I uploaded 500 GPX files without any problem ( apart from English to Dutch! [1]) 👍

Note: all my GPXs are created by various Garmin or Bosch devices, I have no control over how they create the GPXs.

The GPXs created by these devices place the name into the tag: <trk><name>

and not: <metadata><name>

If the <trk><name> key/value is copied to <metadata> Wanderer will create the trail.

[1] something else happened with the 500 GPX file import, the Track Names were translated from English to Dutch!

  • Logbook -> Logboek

githubhacs avatar Jun 04 '24 16:06 githubhacs

I just published v0.6.0. Trails without a name in the metadata tag will now get uploaded and receive a generic name.

Flomp avatar Jun 07 '24 13:06 Flomp