From d39373b769c9e5224aa65a6d7fd4444e93a7f336 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 10 Mar 2020 19:30:08 -0400 Subject: [bug] Fix pathing for provider.json. This `web.HttpFileHandler(srv, "/provider.json", opts.ApiPath+"provider.json")` should have been `opts.ApiPath+"/provider.json"`. The difference is there was a missing / before provider.json. That results in vpnweb trying to open a path that doesn't exist: /etc/leap/config/vpnprovider.json. Because this is so hard to see, its better to use filepath.Join, so these things cannot happen. So I've switched these to the standard library function that joins paths. --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 8fb802d..c43edb7 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "log" "net/http" + "path/filepath" "0xacab.org/leap/vpnweb/pkg/auth" "0xacab.org/leap/vpnweb/pkg/config" @@ -28,10 +29,10 @@ func main() { /* static files */ - web.HttpFileHandler(srv, "/3/configs.json", opts.ApiPath+"/3/configs.json") - web.HttpFileHandler(srv, "/3/service.json", opts.ApiPath+"/3/service.json") - web.HttpFileHandler(srv, "/3/config/eip-service.json", opts.ApiPath+"/3/eip-service.json") - web.HttpFileHandler(srv, "/provider.json", opts.ApiPath+"provider.json") + web.HttpFileHandler(srv, "/3/configs.json", filepath.Join(opts.ApiPath, "3", "configs.json")) + web.HttpFileHandler(srv, "/3/service.json", filepath.Join(opts.ApiPath, "3", "service.json")) + web.HttpFileHandler(srv, "/3/config/eip-service.json", filepath.Join(opts.ApiPath, "3", "eip-service.json")) + web.HttpFileHandler(srv, "/provider.json", filepath.Join(opts.ApiPath, "provider.json")) web.HttpFileHandler(srv, "/ca.crt", opts.ProviderCaPath) web.HttpFileHandler(srv, "/3/ca.crt", opts.ProviderCaPath) -- cgit v1.2.3