|
@ -208,7 +208,12 @@ func (page *Page) ParseForm(form url.Values) []error { |
|
|
errors := make([]error, 0, 4) |
|
|
errors := make([]error, 0, 4) |
|
|
page.cachedOutput = "" |
|
|
page.cachedOutput = "" |
|
|
|
|
|
|
|
|
err := formparser.Select(form.Get("category"), &page.Category, pageCategories, page.Category != "") |
|
|
|
|
|
|
|
|
err := formparser.String(form.Get("name"), &page.Name, 2, 192) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
errors = append(errors, fmt.Errorf("Name: %s", err)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = formparser.Select(form.Get("category"), &page.Category, pageCategories, page.Category != "") |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
errors = append(errors, fmt.Errorf("Category: %s", err)) |
|
|
errors = append(errors, fmt.Errorf("Category: %s", err)) |
|
|
} |
|
|
} |
|
@ -231,15 +236,15 @@ func (page *Page) ParseForm(form url.Values) []error { |
|
|
|
|
|
|
|
|
err = formparser.Select(form.Get("type"), &page.Type, PageTypes, page.Type != "") |
|
|
err = formparser.Select(form.Get("type"), &page.Type, PageTypes, page.Type != "") |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
errors = append(errors, fmt.Errorf("Category: %s", err)) |
|
|
|
|
|
|
|
|
errors = append(errors, fmt.Errorf("Type: %s", err)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
err = formparser.String(form.Get("source"), &page.Source, 0, 102400) |
|
|
err = formparser.String(form.Get("source"), &page.Source, 0, 102400) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
errors = append(errors, fmt.Errorf("Content is too long, max: 100 KB (~17,000 words)")) |
|
|
|
|
|
|
|
|
errors = append(errors, fmt.Errorf("Content is too long, max: 100 KB (~16k words)")) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if len(errors) > 0 { |
|
|
|
|
|
|
|
|
if len(errors) == 0 { |
|
|
errors = nil |
|
|
errors = nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|