mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			486 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			486 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2019 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package files
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| )
 | |
| 
 | |
| func TestCleanUploadFileName(t *testing.T) {
 | |
| 	assert.Equal(t, "", CleanGitTreePath(""))  //nolint
 | |
| 	assert.Equal(t, "", CleanGitTreePath(".")) //nolint
 | |
| 	assert.Equal(t, "a/b", CleanGitTreePath("a/b"))
 | |
| 	assert.Equal(t, "", CleanGitTreePath(".git/b")) //nolint
 | |
| 	assert.Equal(t, "", CleanGitTreePath("a/.git")) //nolint
 | |
| }
 |