func CleanPath(path string) string {
	if len(path) > 1 && path[:2] == "~/" {
		usr, _ := user.Current()
		dir := usr.HomeDir
		if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
			dir = hd
		}
		path = strings.Replace(path, "~/", dir+"/", 1)
	}
	if p, err := filepath.Abs(path); err == nil {
		return p
	}
	return filepath.Clean(path)
}
CleanPath resolves common aliases in a path and cleans it as much as possible
package fsutil
import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
	"os/user"
	"path/filepath"
	"regexp"
	"strings"
	"time"
	"github.com/gopasspw/gopass/pkg/debug"
)
var reCleanFilename = regexp.MustCompile(`[^\w\d@.-]`)
func CleanFilename(in string) string {
	return strings.Trim(reCleanFilename.ReplaceAllString(in, "_"), "_ ")
}