diff options
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/http.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/http/http.go b/src/http/http.go index 5593969..ee5434e 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -147,6 +147,22 @@ func pathHandler(w http.ResponseWriter, r *http.Request) { return } + // if the ?view query is present, retirect to the view handler with the + // needed information + if query["view"] != nil { + + // strip the file before and after the request + strippedFile := strings.Replace(r.URL.Path, root, "", -1) + + // base64 encode the file path + strippedFileBase64 := base64.StdEncoding.EncodeToString([]byte(strippedFile)) + + path := fmt.Sprintf("/view?file=%s&hash=%s", strippedFileBase64, query["hash"][0]) + http.Redirect(w, r, path, http.StatusSeeOther) + return + } + + // define the breadcrumbs breadcrumbsList := breadcrumbs(r) content["Breadcrumbs"] = breadcrumbsList |