@@ -13345,7 +13345,7 @@ func SetDatastoreKeyBulk(ctx context.Context, allKeys []CacheKeyData) ([]Datasto
1334513345
1334613346 // URL encode
1334713347 datastoreId = url .QueryEscape (datastoreId )
13348- if len (cacheData .PublicAuthorization ) == 0 {
13348+ if len (cacheData .PublicAuthorization ) == 0 && cacheData . Category != "protected" {
1334913349 cacheData .PublicAuthorization = uuid .NewV4 ().String ()
1335013350 }
1335113351
@@ -13763,7 +13763,7 @@ func SetDatastoreKeyRevision(ctx context.Context, cacheData CacheKeyData) error
1376313763 }
1376413764
1376513765 cacheData .Authorization = ""
13766- if len (cacheData .PublicAuthorization ) == 0 {
13766+ if len (cacheData .PublicAuthorization ) == 0 && cacheData . Category != "protected" {
1376713767 cacheData .PublicAuthorization = uuid .NewV4 ().String ()
1376813768 }
1376913769
@@ -13829,7 +13829,7 @@ func SetDatastoreKey(ctx context.Context, cacheData CacheKeyData) error {
1382913829 }
1383013830
1383113831 cacheData .Authorization = ""
13832- if len (cacheData .PublicAuthorization ) == 0 {
13832+ if len (cacheData .PublicAuthorization ) == 0 && cacheData . Category != "protected" {
1383313833 cacheData .PublicAuthorization = uuid .NewV4 ().String ()
1383413834 }
1383513835
@@ -13956,7 +13956,9 @@ func GetDatastoreKey(ctx context.Context, id string, category string) (*CacheKey
1395613956
1395713957 category = strings .ReplaceAll (strings .ToLower (category ), " " , "_" )
1395813958 if len (category ) > 0 && category != "default" {
13959- if ! strings .HasSuffix (id , category ) {
13959+ // FIXME: If they key itself is 'test_protected' and category
13960+ // is 'protected' this breaks... Keeping it for now.
13961+ if ! strings .HasSuffix (id , fmt .Sprintf ("_%s" , category )) {
1396013962 id = fmt .Sprintf ("%s_%s" , id , category )
1396113963 }
1396213964 }
@@ -14016,9 +14018,8 @@ func GetDatastoreKey(ctx context.Context, id string, category string) (*CacheKey
1401614018 cacheData = & wrapped .Source
1401714019 } else {
1401814020 key := datastore .NameKey (nameKey , id , nil )
14019-
1402014021 if err := project .Dbclient .Get (ctx , key , cacheData ); err != nil {
14021- //log.Printf("ERROR : Failed getting cache key %s: %s", id, err)
14022+ //log.Printf("[WARNING] : Failed getting cache key %s: %s", id, err)
1402214023
1402314024 if strings .Contains (err .Error (), `cannot load field` ) {
1402414025 log .Printf ("[ERROR] Error in cache key loading. Migrating org cache to new handler (3): %s" , err )
@@ -14089,7 +14090,9 @@ func GetDatastoreKey(ctx context.Context, id string, category string) (*CacheKey
1408914090 newValue , err := HandleKeyDecryption ([]byte (cacheData .Value ), encryptionKey )
1409014091 if err == nil {
1409114092 cacheData .Value = string (newValue )
14092- cacheData .Encrypted = false
14093+
14094+ // Not removing this as it just causes confusion
14095+ //cacheData.Encrypted = false
1409314096 }
1409414097 }
1409514098
0 commit comments