mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Trim whitespace when adding SSH keys (fixes #2447)
This commit is contained in:
		| @@ -165,6 +165,9 @@ func CheckPublicKeyString(content string) (_ string, err error) { | |||||||
| 		return "", errors.New("only a single line with a single key please") | 		return "", errors.New("only a single line with a single key please") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	// remove any unnecessary whitespace now | ||||||
|  | 	content = strings.TrimSpace(content) | ||||||
|  |  | ||||||
| 	fields := strings.Fields(content) | 	fields := strings.Fields(content) | ||||||
| 	if len(fields) < 2 { | 	if len(fields) < 2 { | ||||||
| 		return "", errors.New("too less fields") | 		return "", errors.New("too less fields") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user