-
-
diff --git a/web/ui_controller.go b/web/ui_controller.go
index ca32d4b..ba24c41 100644
--- a/web/ui_controller.go
+++ b/web/ui_controller.go
@@ -25,10 +25,17 @@ func S3Handler(w http.ResponseWriter, r *http.Request) {
return
}
+ var currentPath string
+ if path == "" {
+ currentPath = "/"
+ } else {
+ currentPath = path
+ }
+
dataMap := map[string]interface{}{
"S3Objects": s3Objects,
"Breadcrumbs": util.GenerateBreadcrumbs(path),
- "CurrentPath": path,
+ "CurrentPath": currentPath,
}
tmpl, err := template.ParseFiles("static/index.html")
diff --git a/web/upload_controller.go b/web/upload_controller.go
index f18d4ea..e33a16a 100644
--- a/web/upload_controller.go
+++ b/web/upload_controller.go
@@ -17,8 +17,12 @@ func UploadIndexHandler(w http.ResponseWriter, r *http.Request) {
return
}
- tmpl.Execute(w, nil)
+ dataMap := map[string]interface{}{
+ "CurrentPath": r.URL.Query().Get("currentPath"),
+ }
+ tmpl.Execute(w, dataMap)
}
+
func UploadHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Error(w, "Invalid request method", http.StatusMethodNotAllowed)
@@ -45,5 +49,5 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) {
return
}
- http.Redirect(w, r, "/", http.StatusFound)
+ http.Redirect(w, r, filepath.Join("/s3", path), http.StatusFound)
}