mirror of https://github.com/cheat/cheat.git
fix: resolves #492
Fixes an issue whereby hidden files (like `.DS_Store`) may be wrongly loaded as cheatsheets.
This commit is contained in:
parent
5301442f7c
commit
1dda796e7c
|
@ -48,8 +48,13 @@ func Load(cheatpaths []cp.Cheatpath) ([]map[string]sheet.Sheet, error) {
|
||||||
"/",
|
"/",
|
||||||
)
|
)
|
||||||
|
|
||||||
// ignore dotfiles. Otherwise, we'll likely load .git/*
|
// ignore hidden files and directories. Otherwise, we'll likely load
|
||||||
if strings.HasPrefix(title, ".") {
|
// .git/* and .DS_Store.
|
||||||
|
//
|
||||||
|
// NB: this is still somewhat brittle in that it will miss files
|
||||||
|
// contained within hidden directories in the middle of a path, though
|
||||||
|
// that should not realistically occur.
|
||||||
|
if strings.HasPrefix(title, ".") || strings.HasPrefix(info.Name(), "."){
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue