Skip to content

Commit

Permalink
Swap to using filepath over path for msteams app.zip generation
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardDowling committed Oct 8, 2024
1 parent 236e2c1 commit 00b1b65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions integrations/access/msteams/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"html/template"
"io"
"os"
"path"
"path/filepath"

"github.com/google/uuid"
"github.com/gravitational/trace"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/web/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"net/http"
"net/url"
"os"
"path"
"path/filepath"

"github.com/gravitational/trace"
"github.com/julienschmidt/httprouter"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 00b1b65

Please sign in to comment.