small api url fix

This commit is contained in:
2018-09-11 21:53:07 +02:00
parent 7cc7bd6821
commit bd43fcee92
2 changed files with 5 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package webcontroller
import ( import (
"fmt" "fmt"
"html/template"
"net/http" "net/http"
"strings" "strings"
@@ -56,7 +57,7 @@ func (wc *WebController) serveFileViewer(w http.ResponseWriter, r *http.Request,
"APIResponse": listdata, "APIResponse": listdata,
"Type": "list", "Type": "list",
"OGData": ogData.FromFile(*finfo[0]), "OGData": ogData.FromFile(*finfo[0]),
"APIEndpoint": wc.conf.APIURLExternal, "APIEndpoint": template.URL(wc.conf.APIURLExternal),
}) })
} else { } else {
err = wc.templates.Get().ExecuteTemplate(w, "file_viewer", map[string]interface{}{ err = wc.templates.Get().ExecuteTemplate(w, "file_viewer", map[string]interface{}{
@@ -64,7 +65,7 @@ func (wc *WebController) serveFileViewer(w http.ResponseWriter, r *http.Request,
"APIResponse": finfo[0], "APIResponse": finfo[0],
"Type": "file", "Type": "file",
"OGData": ogData.FromFile(*finfo[0]), "OGData": ogData.FromFile(*finfo[0]),
"APIEndpoint": wc.conf.APIURLExternal, "APIEndpoint": template.URL(wc.conf.APIURLExternal),
}) })
} }
if err != nil { if err != nil {

View File

@@ -2,6 +2,7 @@ package webcontroller
import ( import (
"fmt" "fmt"
"html/template"
"net/http" "net/http"
"fornaxian.com/pixeldrain-web/pixelapi" "fornaxian.com/pixeldrain-web/pixelapi"
@@ -35,7 +36,7 @@ func (wc *WebController) serveListViewer(w http.ResponseWriter, r *http.Request,
"APIResponse": listdata, "APIResponse": listdata,
"Type": "list", "Type": "list",
"OGData": ogData.FromList(*list), "OGData": ogData.FromList(*list),
"APIEndpoint": wc.conf.APIURLExternal, "APIEndpoint": template.URL(wc.conf.APIURLExternal),
}) })
if err != nil { if err != nil {
log.Error("Error executing template file_viewer: %s", err) log.Error("Error executing template file_viewer: %s", err)