mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Stop trimming preceding and suffixing spaces from editor filenames (#18334)
* Stop trimming preceding and suffixing spaces from editor filenames In #5702 it was decided to trim preceding and suffixed spaces aswell as / from editing file filenames. This was because at this point in time the url-safety of Gitea was much poorer. We can now drop this requirement and file editing should work correctly. Fix #18176 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -129,7 +129,7 @@ func GetAuthorAndCommitterUsers(author, committer *IdentityOptions, doer *user_m
 | 
			
		||||
// CleanUploadFileName Trims a filename and returns empty string if it is a .git directory
 | 
			
		||||
func CleanUploadFileName(name string) string {
 | 
			
		||||
	// Rebase the filename
 | 
			
		||||
	name = strings.Trim(path.Clean("/"+name), " /")
 | 
			
		||||
	name = strings.Trim(path.Clean("/"+name), "/")
 | 
			
		||||
	// Git disallows any filenames to have a .git directory in them.
 | 
			
		||||
	for _, part := range strings.Split(name, "/") {
 | 
			
		||||
		if strings.ToLower(part) == ".git" {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user