Skip to content

Commit

Permalink
Fix credentials path trailing slash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rabilrbl committed Aug 29, 2023
1 parent ce547b2 commit 7c0f2c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internals/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func GetLogger() *log.Logger {
func getCredentialsPath() string {
credentials_path := os.Getenv("JIOTV_CREDENTIALS_PATH")
if credentials_path != "" {
// if trailing slash is not present, add it
if !strings.HasSuffix(credentials_path, "/") {
credentials_path += "/"
}
// if folder path is not found, create the folder in current directory
err := os.Mkdir(credentials_path, 0755)
if err != nil {
Expand All @@ -27,7 +31,7 @@ func getCredentialsPath() string {
Log.Println(err)
}
}
credentials_path += "/credentials.json"
credentials_path += "credentials.json"
} else {
credentials_path = "credentials.json"
}
Expand Down

0 comments on commit 7c0f2c5

Please sign in to comment.