From 00b1b656d06feab058263ae1e3c8fa9f8b3db0cf Mon Sep 17 00:00:00 2001 From: Edward Dowling Date: Tue, 8 Oct 2024 13:11:35 +0100 Subject: [PATCH] Swap to using filepath over path for msteams app.zip generation --- integrations/access/msteams/configure.go | 14 +++++++------- lib/web/integrations.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/integrations/access/msteams/configure.go b/integrations/access/msteams/configure.go index 38f23922af12a..42f4808d51b41 100644 --- a/integrations/access/msteams/configure.go +++ b/integrations/access/msteams/configure.go @@ -21,7 +21,7 @@ import ( "html/template" "io" "os" - "path" + "path/filepath" "github.com/google/uuid" "github.com/gravitational/trace" @@ -83,7 +83,7 @@ func Configure(targetDir, appID, appSecret, tenantID string) error { printStep(&step, "Created target directory: %s", targetDir) - configWriter, err := os.Create(path.Join(targetDir, "teleport-msteams.toml")) + configWriter, err := os.Create(filepath.Join(targetDir, "teleport-msteams.toml")) if err != nil { return trace.Wrap(err) } @@ -111,13 +111,13 @@ func copyAssets(targetDir string) error { } for _, d := range a { - in, err := assets.Open(path.Join("_tpl", d.Name())) + in, err := assets.Open(filepath.Join("_tpl", d.Name())) if err != nil { return trace.Wrap(err) } defer in.Close() - out, err := os.Create(path.Join(targetDir, d.Name())) + out, err := os.Create(filepath.Join(targetDir, d.Name())) if err != nil { return trace.Wrap(err) } @@ -132,7 +132,7 @@ func copyAssets(targetDir string) error { } func ConfigureAppZip(targetDir, fileName string, p Payload) error { - manifestWriter, err := os.Create(path.Join(targetDir, "manifest.json")) + manifestWriter, err := os.Create(filepath.Join(targetDir, "manifest.json")) if err != nil { return trace.Wrap(err) } @@ -143,7 +143,7 @@ func ConfigureAppZip(targetDir, fileName string, p Payload) error { copyAssets(targetDir) - z, err := os.Create(path.Join(targetDir, fileName)) + z, err := os.Create(filepath.Join(targetDir, fileName)) if err != nil { return trace.Wrap(err) } @@ -153,7 +153,7 @@ func ConfigureAppZip(targetDir, fileName string, p Payload) error { defer w.Close() for _, n := range zipFiles { - in, err := os.Open(path.Join(targetDir, n)) + in, err := os.Open(filepath.Join(targetDir, n)) if err != nil { return trace.Wrap(err) } diff --git a/lib/web/integrations.go b/lib/web/integrations.go index 18f65de93b238..3f8b94c03e060 100644 --- a/lib/web/integrations.go +++ b/lib/web/integrations.go @@ -22,7 +22,7 @@ import ( "net/http" "net/url" "os" - "path" + "path/filepath" "github.com/gravitational/trace" "github.com/julienschmidt/httprouter" @@ -260,7 +260,7 @@ func (h *Handler) integrationsMsTeamsAppZipGet(w http.ResponseWriter, r *http.Re TeamsAppID: spec.Msteams.TeamsAppId, }) - fileBytes, err := os.ReadFile(path.Join(targetDir, "app.zip")) + fileBytes, err := os.ReadFile(filepath.Join(targetDir, "app.zip")) if err != nil { return nil, trace.Wrap(err) }