Skip to content

Bug: api.Files.update (keywords-only PATCH) resets Groups metadata #40

Description

File: lib/api/files.ts

Description

When PATCH /api/marti/package/:uid is called with only keywords (no channels),
the handler calls api.Files.update() which updates keyword metadata on the TAK server.
As a side effect, the TAK server clears the Groups field for that package hash, so any
channel assignment made during the original upload is lost.

Observed behaviour

  1. Upload package with ?groups=UTL+-+Utilities → channels correctly shows ['UTL - Utilities']
  2. PATCH with {"keywords": [...]} → channels resets to []

Impact

It is currently impossible to set both keywords AND a channel assignment on a package
using sequential POST + PATCH calls without either creating a duplicate entry (dfpc-coe/CloudTAK#1574)
or losing the channel (this bug).

Workaround

Set both keywords and groups together on the initial POST using repeated query
parameters — the same format the CloudTAK UI uses:

POST /api/marti/package
  ?name=Kaikoura+100y+Inundation+Floodmap
  &groups=UTL+-+Utilities
  &keywords=Canterbury
  &keywords=Kaikoura
  &keywords=Inundation
  &keywords=Floodmap

This sets keywords and channel correctly in a single request with no duplicate and
no subsequent PATCH needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions