mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fix default setting (#740)
* push validate/defaults into datastore we weren't setting a timestamp in route insert when we needed to create an app there. that whole thing isn't atomic, but this fixes the timestamp issue. closes #738 seems like we should do similar with the FireBeforeX stuff too. * fix tests * app name validation was buggy, an upper cased letter failed. now it doesn't. uses unicode now. * removes duplicate errors for datastore and models validation that were used interchangably but weren't.
This commit is contained in:
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
@@ -34,7 +35,7 @@ func (a *App) Validate() error {
|
||||
return ErrAppsTooLongName
|
||||
}
|
||||
for _, c := range a.Name {
|
||||
if (c < '0' || '9' < c) && (c < 'A' || 'Z' > c) && (c < 'a' || 'z' < c) && c != '_' && c != '-' {
|
||||
if !(unicode.IsLetter(c) || unicode.IsNumber(c) || c == '_' || c == '-') {
|
||||
return ErrAppsInvalidName
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user