19362: Fix error when GetCollection arg is neither UUID nor PDH.
authorTom Clegg <tom@curii.com>
Thu, 15 Sep 2022 20:24:18 +0000 (16:24 -0400)
committerTom Clegg <tom@curii.com>
Tue, 20 Sep 2022 20:32:10 +0000 (16:32 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/controller/federation/conn.go
services/api/test/fixtures/collections.yml

index ffb150bf26aa148b511f4bbde98305469ffef5df..89f68a5ef1848aab0579ace235a60c92a3c05879 100644 (file)
@@ -276,6 +276,9 @@ func (conn *Conn) CollectionGet(ctx context.Context, options arvados.GetOptions)
                }
                return c, err
        }
+       if len(options.UUID) < 34 || options.UUID[32] != '+' {
+               return arvados.Collection{}, httpErrorf(http.StatusNotFound, "invalid UUID or PDH %q", options.UUID)
+       }
        // UUID is a PDH
        first := make(chan arvados.Collection, 1)
        err := conn.tryLocalThenRemotes(ctx, options.ForwardedFor, func(ctx context.Context, remoteID string, be backend) error {
index 1f2eab73afedd748070086e8083f8bccc2256af8..a5c3e63dde65ffcd935b016b7f255d6effffbe0e 100644 (file)
@@ -987,8 +987,8 @@ collection_with_list_prop_odd:
     listprop: [elem1, elem3, 5]
 
 collection_with_list_prop_even:
-  uuid: zzzzz-4zz18-listpropertyeven
-  current_version_uuid: zzzzz-4zz18-listpropertyeven
+  uuid: zzzzz-4zz18-listpropertyevn
+  current_version_uuid: zzzzz-4zz18-listpropertyevn
   portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2015-02-13T17:22:54Z
@@ -1002,8 +1002,8 @@ collection_with_list_prop_even:
     listprop: [elem2, 4, elem6, ELEM8]
 
 collection_with_listprop_elem1:
-  uuid: zzzzz-4zz18-listpropelem1
-  current_version_uuid: zzzzz-4zz18-listpropelem1
+  uuid: zzzzz-4zz18-listpropelemen1
+  current_version_uuid: zzzzz-4zz18-listpropelemen1
   portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   created_at: 2015-02-13T17:22:54Z