18903: keep-web: when logging a file upload or download, if the
authorWard Vandewege <ward@curii.com>
Wed, 23 Mar 2022 18:08:09 +0000 (14:08 -0400)
committerWard Vandewege <ward@curii.com>
Wed, 23 Mar 2022 19:21:11 +0000 (15:21 -0400)
       collection UUID is not known, blank the field rather than
       populating it with the PDH (which is also present in a separate
       field).

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

services/keep-web/handler.go

index 97ec95e3aac3f96111ab49014635ae742073b4e8..ef61b06873c50661bb29f622bfb1b5e9a1097495 100644 (file)
@@ -913,6 +913,14 @@ func (h *handler) logUploadOrDownload(
                        WithField("collection_file_path", filepath)
                props["collection_uuid"] = collection.UUID
                props["collection_file_path"] = filepath
+               // h.determineCollection populates the collection_uuid prop with the PDH, if
+               // this collection is being accessed via PDH. In that case, blank the
+               // collection_uuid field so that consumers of the log entries can rely on it
+               // being a UUID, or blank. The PDH remains available via the
+               // portable_data_hash property.
+               if props["collection_uuid"] == collection.PortableDataHash {
+                       props["collection_uuid"] = ""
+               }
        }
        if r.Method == "PUT" || r.Method == "POST" {
                log.Info("File upload")