mirror of
				https://github.com/restic/restic.git
				synced 2025-11-04 03:34:41 +00:00 
			
		
		
		
	Merge pull request #1861 from McKael/fix_find_ignore_case
Fix find -i (case-insensitive search)
This commit is contained in:
		
							
								
								
									
										6
									
								
								changelog/unreleased/pull-1861
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								changelog/unreleased/pull-1861
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					Bugfix: Fix case-insensitive search with restic find
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					We've fixed the behavior for `restic find -i PATTERN`, which was
 | 
				
			||||||
 | 
					broken in v0.9.1.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					https://github.com/restic/restic/pull/1861
 | 
				
			||||||
@@ -198,12 +198,12 @@ func (f *Finder) findInSnapshot(ctx context.Context, sn *restic.Snapshot) error
 | 
				
			|||||||
			return false, nil
 | 
								return false, nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		name := node.Name
 | 
							normalizedNodepath := nodepath
 | 
				
			||||||
		if f.pat.ignoreCase {
 | 
							if f.pat.ignoreCase {
 | 
				
			||||||
			name = strings.ToLower(name)
 | 
								normalizedNodepath = strings.ToLower(nodepath)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		foundMatch, err := filter.Match(f.pat.pattern, nodepath)
 | 
							foundMatch, err := filter.Match(f.pat.pattern, normalizedNodepath)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return false, err
 | 
								return false, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -213,7 +213,7 @@ func (f *Finder) findInSnapshot(ctx context.Context, sn *restic.Snapshot) error
 | 
				
			|||||||
			errIfNoMatch    error
 | 
								errIfNoMatch    error
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
		if node.Type == "dir" {
 | 
							if node.Type == "dir" {
 | 
				
			||||||
			childMayMatch, err := filter.ChildMatch(f.pat.pattern, nodepath)
 | 
								childMayMatch, err := filter.ChildMatch(f.pat.pattern, normalizedNodepath)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				return false, err
 | 
									return false, err
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user