Multiple fixes and added article get endpoint for authors

This commit is contained in:
2022-02-02 16:00:56 +01:00
parent 6a6283f781
commit 3c8fd32345
11 changed files with 141 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import (
"TheAdversary/database"
"github.com/gorilla/mux"
"net/http"
"path"
"path/filepath"
"text/template"
"time"
@@ -40,7 +41,7 @@ func Article(w http.ResponseWriter, r *http.Request) {
ta := tmplArticle{
Title: article.Title,
BasePath: config.Address + config.Path,
BasePath: config.Address + path.Join("/", config.SubPath),
Summary: article.Summary,
Image: article.Image,
Authors: authors,

View File

@@ -9,7 +9,7 @@ import (
)
func ServePath(w http.ResponseWriter, r *http.Request) {
path := filepath.Join(config.FrontendDir, strings.TrimPrefix(r.URL.Path, config.Path))
path := filepath.Join(config.FrontendDir, strings.TrimPrefix(r.URL.Path, config.SubPath))
if _, err := os.Stat(path); os.IsNotExist(err) {
Error404(w, r)
} else {