1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 17:17:19 +00:00
Files
gitea/services/repository/files/file_test.go
wxiaoguang 4fc626daa1 Refactor editor (#34780)
A complete rewrite
2025-06-21 19:20:51 +08:00

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
}