diff options
author | Micah Anderson <micah@riseup.net> | 2020-03-10 19:30:08 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2020-03-10 19:30:08 -0400 |
commit | d39373b769c9e5224aa65a6d7fd4444e93a7f336 (patch) | |
tree | 4f9920ba44091b2f842fe067b27290c9ebd44416 /main.go | |
parent | 9fc3cfbc852cee3587e4011c805067d9c182f886 (diff) |
[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.
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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) |