Fix /api/v1/new and Makefile.

main
Leonid Maslakov 1 year ago
parent cde971bb95
commit 77034fc591

@ -17,7 +17,7 @@ all:
chmod +x ./dist/bin/$(NAME)
fmt:
@$(GO) -w $(shell find ./ -type f -name '*.go')
@$(GOFMT) -w $(shell find ./ -type f -name '*.go')
clean:
rm -rf ./dist/

@ -74,6 +74,10 @@ func PasteAddFromForm(form url.Values, db storage.DB, titleMaxLen int, bodyMaxLe
}
// Check syntax
if paste.Syntax == "" {
paste.Syntax = "plaintext"
}
syntaxOk := false
for _, name := range lexerNames {
if name == paste.Syntax {

@ -19,12 +19,12 @@
package web
import (
"embed"
"git.lcomrade.su/root/lenpaste/internal/config"
"git.lcomrade.su/root/lenpaste/internal/logger"
"git.lcomrade.su/root/lenpaste/internal/storage"
chromaLexers "github.com/alecthomas/chroma/lexers"
"html/template"
"embed"
textTemplate "text/template"
)

@ -20,6 +20,7 @@ package web
import (
"bytes"
"embed"
"errors"
"fmt"
"html/template"
@ -27,7 +28,6 @@ import (
"path/filepath"
"strconv"
"strings"
"embed"
)
type Locale map[string]string

Loading…
Cancel
Save