diff --git a/fs/rc/rcserver/rcserver.go b/fs/rc/rcserver/rcserver.go index 0c302a80d..38f3e80ac 100644 --- a/fs/rc/rcserver/rcserver.go +++ b/fs/rc/rcserver/rcserver.go @@ -243,6 +243,7 @@ func (s *Server) serveRemote(w http.ResponseWriter, r *http.Request, path string } directory.Serve(w, r) } else { + path = strings.Trim(path, "/") o, err := f.NewObject(path) if err != nil { writeError(path, nil, w, errors.Wrap(err, "failed to find object"), http.StatusInternalServerError) diff --git a/fs/rc/rcserver/rcserver_test.go b/fs/rc/rcserver/rcserver_test.go index 287c865f0..647b3620a 100644 --- a/fs/rc/rcserver/rcserver_test.go +++ b/fs/rc/rcserver/rcserver_test.go @@ -8,6 +8,7 @@ import ( "net/http" "net/http/httptest" "regexp" + "strings" "testing" "time" @@ -229,7 +230,7 @@ func TestRemoteServing(t *testing.T) { Expected: `{ "error": "failed to find object: object not found", "input": null, - "path": "/notfound", + "path": "notfound", "status": 404 } `, @@ -268,6 +269,14 @@ func TestRemoteServing(t *testing.T) { Headers: map[string]string{ "Content-Length": "18", }, + }, { + Name: "file with no slash after ]", + URL: strings.TrimRight(remoteURL, "/") + "file.txt", + Status: http.StatusOK, + Expected: "this is file1.txt\n", + Headers: map[string]string{ + "Content-Length": "18", + }, }, { Name: "file2", URL: remoteURL + "dir/file2.txt",