Browse Source
			 
			
			Fix importing Bitwarden exports (#4030 ) 
 
When importing Bitwarden JSON exports, these would fail because the last
modification date was also imported and caused our out-off-sync check to
kick-in. This PR fixes this by checking if we are doing an import, and
skip this check.
Fixes  #4005  
			
			
				 
		
			
				
					
						Mathijs van Veluw 
					
					2 years ago 
							GitHub 
							
						 
					
				 
				
			 
		 
		
			
				
					GPG Key ID:  
		
		
		
	
		
			
				 1 changed files  with 
10 additions  and 
7 deletions 
			 
			
		 
		
			
				
					
					
					  
					src/api/core/ciphers.rs 
				 
			
		 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					
						
						
							
								 
						
						
					 
					@ -359,6 +359,8 @@ pub async fn update_cipher_from_data( 
			
		
	
		
		
			
				
					     enforce_personal_ownership_policy ( Some ( & data ) ,   headers ,   conn ) . await ? ;      enforce_personal_ownership_policy ( Some ( & data ) ,   headers ,   conn ) . await ? ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     // Check that the client isn't updating an existing cipher with stale data.
      // Check that the client isn't updating an existing cipher with stale data.
  
			
		
	
		
		
			
				
					     // And only perform this check when not importing ciphers, else the date/time check will fail.
  
			
		
	
		
		
			
				
					     if   ut   ! =   UpdateType ::None   {  
			
		
	
		
		
			
				
					         if   let   Some ( dt )   =   data . LastKnownRevisionDate   {          if   let   Some ( dt )   =   data . LastKnownRevisionDate   {  
			
		
	
		
		
			
				
					             match   NaiveDateTime ::parse_from_str ( & dt ,   "%+" )   {              match   NaiveDateTime ::parse_from_str ( & dt ,   "%+" )   {  
			
		
	
		
		
			
				
					                 // ISO 8601 format
                  // ISO 8601 format
  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -369,6 +371,7 @@ pub async fn update_cipher_from_data( 
			
		
	
		
		
			
				
					                 Ok ( _ )   = >   ( ) ,                  Ok ( _ )   = >   ( ) ,  
			
		
	
		
		
			
				
					             }              }  
			
		
	
		
		
			
				
					         }          }  
			
		
	
		
		
			
				
					     }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     if   cipher . organization_uuid . is_some ( )   & &   cipher . organization_uuid   ! =   data . OrganizationId   {      if   cipher . organization_uuid . is_some ( )   & &   cipher . organization_uuid   ! =   data . OrganizationId   {  
			
		
	
		
		
			
				
					         err ! ( "Organization mismatch. Please resync the client before updating the cipher" )          err ! ( "Organization mismatch. Please resync the client before updating the cipher" )