Multiple fixes and added article get endpoint for authors
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user