mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-11-03 00:40:56 +00:00 
			
		
		
		
	Fix #475.
This commit is contained in:
		
							parent
							
								
									df10fa3912
								
							
						
					
					
						commit
						99740dca58
					
				@ -20,8 +20,10 @@ public class PublicKeyFileStoreController {
 | 
				
			|||||||
        logger.log("Writing public keys to disk")
 | 
					        logger.log("Writing public keys to disk")
 | 
				
			||||||
        if clear {
 | 
					        if clear {
 | 
				
			||||||
            let validPaths = Set(secrets.map { publicKeyPath(for: $0) }).union(Set(secrets.map { sshCertificatePath(for: $0) }))
 | 
					            let validPaths = Set(secrets.map { publicKeyPath(for: $0) }).union(Set(secrets.map { sshCertificatePath(for: $0) }))
 | 
				
			||||||
            let untracked = Set(try FileManager.default.contentsOfDirectory(atPath: directory)
 | 
					            let contentsOfDirectory = (try? FileManager.default.contentsOfDirectory(atPath: directory)) ?? []
 | 
				
			||||||
                .map { "\(directory)/\($0)" })
 | 
					            let fullPathContents = contentsOfDirectory.map { "\(directory)/\($0)" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            let untracked = Set(fullPathContents)
 | 
				
			||||||
                .subtracting(validPaths)
 | 
					                .subtracting(validPaths)
 | 
				
			||||||
            for path in untracked {
 | 
					            for path in untracked {
 | 
				
			||||||
                try? FileManager.default.removeItem(at: URL(fileURLWithPath: path))
 | 
					                try? FileManager.default.removeItem(at: URL(fileURLWithPath: path))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user