updated automigrate templates, added js bindings tests and updated models IsNew behavior
This commit is contained in:
@@ -77,7 +77,7 @@ func FindUploadedFiles(r *http.Request, key string) ([]*UploadedFile, error) {
|
||||
sanitizedName := inflector.Snakecase(originalName)
|
||||
if length := len(sanitizedName); length < 3 {
|
||||
// the name is too short so we concatenate an additional random part
|
||||
sanitizedName += ("_" + security.RandomString(10))
|
||||
sanitizedName += security.RandomString(10)
|
||||
} else if length > 100 {
|
||||
// keep only the first 100 characters (it is multibyte safe after Snakecase)
|
||||
sanitizedName = sanitizedName[:100]
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestFindUploadedFiles(t *testing.T) {
|
||||
filename string
|
||||
expectedPattern string
|
||||
}{
|
||||
{"ab.png", `^ab_\w{10}_\w{10}\.png$`},
|
||||
{"ab.png", `^ab\w{10}_\w{10}\.png$`},
|
||||
{"test", `^test_\w{10}\.txt$`},
|
||||
{"a b c d!@$.j!@$pg", `^a_b_c_d_\w{10}\.jpg$`},
|
||||
{strings.Repeat("a", 150), `^a{100}_\w{10}\.txt$`},
|
||||
|
||||
Reference in New Issue
Block a user