Files
gitea/services/repository/files/file_test.go
admin 7a61cd3abc
Some checks are pending
release-nightly / nightly-binary (push) Waiting to run
release-nightly / nightly-docker-rootful (push) Waiting to run
release-nightly / nightly-docker-rootless (push) Waiting to run
gitea source for verification 2026-05-22
2026-05-22 16:44:59 +08:00

28 lines
503 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) {
cases := []struct {
input, expected string
}{
{"", ""},
{".", ""},
{"a/./b", "a/b"},
{"a.git", "a.git"},
{".git/b", ""},
{"a/.git", ""},
{"/a/../../b", "b"},
}
for _, c := range cases {
assert.Equal(t, c.expected, CleanGitTreePath(c.input), "input: %q", c.input)
}
}