Skip to content

Commit

Permalink
address review feedback (thanks zyga)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipaca committed Jan 11, 2017
1 parent ece9ea4 commit 13445d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion wrappers/desktop.go
Expand Up @@ -126,10 +126,11 @@ func sanitizeDesktopFile(s *snap.Info, desktopFile string, rawcontent []byte) []
newContent := []string{}

scanner := bufio.NewScanner(bytes.NewReader(rawcontent))
for scanner.Scan() {
for i := 0; scanner.Scan(); i++ {
line := scanner.Text()

if !isValidDesktopFileLine(line) {
logger.Debugf("ignoring line %d (%q) in source of desktop file %q", i, line, filepath.Base(desktopFile))
continue
}

Expand Down
6 changes: 3 additions & 3 deletions wrappers/desktop_test.go
Expand Up @@ -280,8 +280,8 @@ apps:

func (s *sanitizeDesktopFileSuite) TestLangLang(c *C) {
langs := []struct {
in string
out bool
line string
isValid bool
}{
// langCodes
{"Name[lang]=lang-alone", true},
Expand All @@ -302,6 +302,6 @@ func (s *sanitizeDesktopFileSuite) TestLangLang(c *C) {
{"Icon[xx]=bar", false},
}
for _, t := range langs {
c.Assert(wrappers.IsValidDesktopFileLine(t.in), Equals, t.out)
c.Assert(wrappers.IsValidDesktopFileLine(t.line), Equals, t.isValid)
}
}

0 comments on commit 13445d2

Please sign in to comment.