forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Frontport Changelogs (go-gitea#19088) Restrict email address validation (go-gitea#17688) Fix lfs bug (go-gitea#19072)
- Loading branch information
Showing
14 changed files
with
291 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2022 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package storage | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestLocalPathIsValid(t *testing.T) { | ||
kases := []struct { | ||
path string | ||
valid bool | ||
}{ | ||
{ | ||
"a/0/a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14", | ||
true, | ||
}, | ||
{ | ||
"../a/0/a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14", | ||
false, | ||
}, | ||
{ | ||
"a\\0\\a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14", | ||
true, | ||
}, | ||
{ | ||
"b/../a/0/a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14", | ||
false, | ||
}, | ||
{ | ||
"..\\a/0/a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14", | ||
false, | ||
}, | ||
} | ||
|
||
for _, k := range kases { | ||
t.Run(k.path, func(t *testing.T) { | ||
assert.EqualValues(t, k.valid, isLocalPathValid(k.path)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.