mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
20191217 gosec (#796)
* Add gosec to the Makefile Signed-off-by: Chris Cummer <chriscummer@me.com> * Fix some issues found by gosec Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/chroma/formatters"
|
||||
@@ -91,7 +92,7 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
func (widget *Widget) formattedText() string {
|
||||
filePath, _ := utils.ExpandHomeDir(widget.CurrentSource())
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
file, err := os.Open(filepath.Clean(filePath))
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
@@ -124,9 +125,9 @@ func (widget *Widget) formattedText() string {
|
||||
}
|
||||
|
||||
func (widget *Widget) plainText() string {
|
||||
filePath, _ := utils.ExpandHomeDir(widget.CurrentSource())
|
||||
filePath, _ := utils.ExpandHomeDir(filepath.Clean(widget.CurrentSource()))
|
||||
|
||||
text, err := ioutil.ReadFile(filePath)
|
||||
text, err := ioutil.ReadFile(filepath.Clean(filePath))
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user