leave some comments

pull/48/head
Henrique Dias 2016-02-07 15:14:56 +00:00
parent 427989d639
commit c89f1dfd46
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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{