File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -443,28 +443,29 @@ impl VssStoreInner {
443443 if self . schema_version == VssSchemaVersion :: V1 {
444444 let prefix = format ! ( "{}#{}" , primary_namespace, secondary_namespace) ;
445445 self . key_obfuscator . obfuscate ( & prefix)
446+ } else if primary_namespace. is_empty ( ) {
447+ String :: new ( )
446448 } else {
447449 // Default to V0 schema
448450 format ! ( "{}#{}" , primary_namespace, secondary_namespace)
449451 }
450452 }
451453
452454 fn extract_key ( & self , unified_key : & str ) -> io:: Result < String > {
453- let mut parts = if self . schema_version == VssSchemaVersion :: V1 {
455+ let obfuscated_key = if self . schema_version == VssSchemaVersion :: V1 {
454456 let mut parts = unified_key. splitn ( 2 , '#' ) ;
455457 let _obfuscated_namespace = parts. next ( ) ;
456- parts
457- } else {
458+ parts. next ( )
459+ } else if unified_key . contains ( '#' ) {
458460 // Default to V0 schema
459461 let mut parts = unified_key. splitn ( 3 , '#' ) ;
460462 let ( _primary_namespace, _secondary_namespace) = ( parts. next ( ) , parts. next ( ) ) ;
461- parts
463+ parts. next ( )
464+ } else {
465+ Some ( unified_key)
462466 } ;
463- match parts. next ( ) {
464- Some ( obfuscated_key) => {
465- let actual_key = self . key_obfuscator . deobfuscate ( obfuscated_key) ?;
466- Ok ( actual_key)
467- } ,
467+ match obfuscated_key {
468+ Some ( obfuscated_key) => Ok ( self . key_obfuscator . deobfuscate ( obfuscated_key) ?) ,
468469 None => Err ( Error :: new ( ErrorKind :: InvalidData , "Invalid key format" ) ) ,
469470 }
470471 }
You can’t perform that action at this time.
0 commit comments