domain_new.go: reject domains with /
This commit is contained in:
parent
feeda79923
commit
a9c48a8394
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -10,6 +11,10 @@ func domainNew(ownerHex string, name string, domain string) error {
|
|||||||
return errorMissingField
|
return errorMissingField
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(domain, "/") {
|
||||||
|
return errorInvalidDomain
|
||||||
|
}
|
||||||
|
|
||||||
statement := `
|
statement := `
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
domains (ownerHex, name, domain, creationDate)
|
domains (ownerHex, name, domain, creationDate)
|
||||||
|
@ -45,3 +45,4 @@ var errorThreadLocked = errors.New("This thread is locked. You cannot add new co
|
|||||||
var errorDatabaseMigration = errors.New("Encountered error applying database migration.")
|
var errorDatabaseMigration = errors.New("Encountered error applying database migration.")
|
||||||
var errorNoSuchUnsubscribeSecretHex = errors.New("Invalid unsubscribe link.")
|
var errorNoSuchUnsubscribeSecretHex = errors.New("Invalid unsubscribe link.")
|
||||||
var errorEmptyPaths = errors.New("Empty paths field.")
|
var errorEmptyPaths = errors.New("Empty paths field.")
|
||||||
|
var errorInvalidDomain = errors.New("Invalid domain name. Do not include the URL path after the forward slash.")
|
||||||
|
Loading…
Reference in New Issue
Block a user