Loading
Fix set metadata for primary discovered outputs
We were previously setting metadata on the path that `filename_override` points to, which (should be an output in the job working directory, or an output in the object store. That does not work for `unnnamed_outputs` that are inferred via galaxy.json and that are discovered using collect_dynamic_outputs. In most cases that doesn't lead to an exception, but it does fail for bam files (and a small subset of other datatypes I would guess) if you specify the extension explicitly (if the extension is not set, sniffing on the empty dataset results in `data`, which will prevent the exception). For datatypes that don't fail in `set_metadata` on empty input files metadata would then be set again when collecting dynamic outputs, this time using the correct path. The fix here is to check whether the file we're setting metadata for is actually an unnamed output, and override the path with the path to the file in the working directory. To prevent setting metadata twice we also skip setting metadata on files that already have a database id (which should only be these primary discovered outputs).