leave some comments
parent
427989d639
commit
c89f1dfd46
|
@ -23,6 +23,7 @@ func GET(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
|
|||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
// Using Caddy's Browse middleware
|
||||
b := browse.Browse{
|
||||
Next: middleware.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
return 404, nil
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// CanBeEdited checks if a filename has a supported extension
|
||||
// CanBeEdited checks if the extension of a file is supported by the editor
|
||||
func CanBeEdited(filename string) bool {
|
||||
extensions := [...]string{
|
||||
"md", "markdown", "mdown", "mmark",
|
||||
|
@ -28,6 +28,7 @@ func CanBeEdited(filename string) bool {
|
|||
".css", ".sass", ".scss",
|
||||
".js",
|
||||
".html",
|
||||
".txt",
|
||||
}
|
||||
|
||||
for _, extension := range extensions {
|
||||
|
@ -197,6 +198,7 @@ func Run(c *config.Config) {
|
|||
}
|
||||
}
|
||||
|
||||
// IsEmpty checks if a folder is empty
|
||||
func IsEmpty(name string) (bool, error) {
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
|
@ -208,7 +210,7 @@ func IsEmpty(name string) (bool, error) {
|
|||
if err == io.EOF {
|
||||
return true, nil
|
||||
}
|
||||
return false, err // Either not empty or error, suits both cases
|
||||
return false, err
|
||||
}
|
||||
|
||||
var splitCapitalizeExceptions = map[string]string{
|
||||
|
|
Loading…
Reference in New Issue