mirror of
				https://github.com/vbatts/tar-split.git
				synced 2025-10-26 08:30:56 +00:00 
			
		
		
		
	xattr: fix the failure on empty list
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
		
							parent
							
								
									ed6b293839
								
							
						
					
					
						commit
						2685cd3cc5
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -29,7 +29,14 @@ func List(path string) ([]string, error) { | |||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return strings.Split(strings.TrimRight(string(dest[:i]), nilByte), nilByte), nil | ||||
| 
 | ||||
| 	// If the returned list is empty, return nil instead of []string{""} | ||||
| 	str := string(dest[:i]) | ||||
| 	if str == "" { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| 
 | ||||
| 	return strings.Split(strings.TrimRight(str, nilByte), nilByte), nil | ||||
| } | ||||
| 
 | ||||
| const nilByte = "\x00" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue