diff options
-rw-r--r-- | commands/compose/attach.go | 13 | ||||
-rw-r--r-- | commands/util.go | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/commands/compose/attach.go b/commands/compose/attach.go index 7e50ea85..520fc6f7 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -59,6 +59,19 @@ func (a Attach) addPath(aerc *widgets.Aerc, path string) error { attachments = []string{path} } + if !strings.HasPrefix(path, ".") && !strings.Contains(path, "/.") { + log.Debugf("removing hidden files from glob results") + for i := len(attachments) - 1; i >= 0; i-- { + if strings.HasPrefix(filepath.Base(attachments[i]), ".") { + if i == len(attachments)-1 { + attachments = attachments[:i] + continue + } + attachments = append(attachments[:i], attachments[i+1:]...) + } + } + } + composer, _ := aerc.SelectedTabContent().(*widgets.Composer) for _, attach := range attachments { log.Debugf("attaching '%s'", attach) diff --git a/commands/util.go b/commands/util.go index fe0b2756..8b7060ec 100644 --- a/commands/util.go +++ b/commands/util.go @@ -97,6 +97,19 @@ func CompletePath(path string) []string { return nil } + if !strings.HasPrefix(path, ".") && !strings.Contains(path, "/.") { + log.Debugf("removing hidden files from glob results") + for i := len(matches) - 1; i >= 0; i-- { + if strings.HasPrefix(filepath.Base(matches[i]), ".") { + if i == len(matches)-1 { + matches = matches[:i] + continue + } + matches = append(matches[:i], matches[i+1:]...) + } + } + } + for i, m := range matches { if isDir(m) { matches[i] = m + "/" |