From b635501fb773eba2efb80887edab00abc927f8da Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 1 Feb 2015 02:49:09 -0800 Subject: [PATCH] Add StrictSlash for path re-direction --- pkg/api/minioapi/minioapi.go | 2 ++ pkg/api/webuiapi/webuiapi.go | 9 ++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/api/minioapi/minioapi.go b/pkg/api/minioapi/minioapi.go index 9b2bcc2da..d3d2acf8f 100644 --- a/pkg/api/minioapi/minioapi.go +++ b/pkg/api/minioapi/minioapi.go @@ -54,6 +54,8 @@ func HttpHandler(storage mstorage.Storage) http.Handler { var api = minioApi{} api.storage = storage + // Re-direct /path to /path/ + mux.StrictSlash(true) mux.HandleFunc("/", api.listBucketsHandler).Methods("GET") mux.HandleFunc("/{bucket}/", api.listObjectsHandler).Methods("GET") mux.HandleFunc("/{bucket}/", api.putBucketHandler).Methods("PUT") diff --git a/pkg/api/webuiapi/webuiapi.go b/pkg/api/webuiapi/webuiapi.go index 91e19c371..2b9ae8ea4 100644 --- a/pkg/api/webuiapi/webuiapi.go +++ b/pkg/api/webuiapi/webuiapi.go @@ -29,14 +29,9 @@ type webUiApi struct { func HttpHandler() http.Handler { mux := mux.NewRouter() var api = webUiApi{} + + mux.StrictSlash(true) mux.HandleFunc("/", api.homeHandler).Methods("GET") - /* - mux.HandleFunc("/{bucket}/", api.listObjectsHandler).Methods("GET") - mux.HandleFunc("/{bucket}/", api.putBucketHandler).Methods("PUT") - mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET") - mux.HandleFunc("/{bucket}/{object:.*}", api.headObjectHandler).Methods("HEAD") - mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT") - */ return mux }