2018-11-14 19:28:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
package archiver
|
|
|
|
|
|
|
|
|
2018-11-17 14:56:58 +00:00
|
|
|
import "strings"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 17:11:34 +00:00
|
|
|
var IndexNames = []string {
|
2022-08-28 15:27:08 +00:00
|
|
|
|
|
|
|
"_index.html", "_index.htm",
|
|
|
|
"_index.xhtml", "_index.xht",
|
|
|
|
"_index.txt",
|
|
|
|
"_index.json",
|
|
|
|
"_index.xml",
|
|
|
|
|
2018-11-14 19:28:25 +00:00
|
|
|
"index.html", "index.htm",
|
|
|
|
"index.xhtml", "index.xht",
|
|
|
|
"index.txt",
|
|
|
|
"index.json",
|
|
|
|
"index.xml",
|
|
|
|
}
|
|
|
|
|
2018-11-17 14:56:58 +00:00
|
|
|
|
|
|
|
var StripSuffixes = []string {
|
2018-11-17 13:49:17 +00:00
|
|
|
".html", ".htm",
|
|
|
|
".xhtml", ".xht",
|
|
|
|
".txt",
|
|
|
|
}
|
|
|
|
|
2018-11-17 14:56:58 +00:00
|
|
|
|
|
|
|
var SkipPrefixes = []string {
|
|
|
|
".",
|
|
|
|
"#",
|
|
|
|
}
|
|
|
|
|
|
|
|
var SkipSuffixes = []string {
|
|
|
|
"~",
|
|
|
|
"#",
|
|
|
|
".log",
|
|
|
|
".tmp",
|
|
|
|
".temp",
|
|
|
|
".lock",
|
|
|
|
}
|
|
|
|
|
|
|
|
var SkipInfixes = []string {
|
|
|
|
"#",
|
|
|
|
}
|
|
|
|
|
|
|
|
var SkipNames = []string {
|
|
|
|
"Thumbs.db",
|
|
|
|
".DS_Store",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ShouldSkipName (_name string) (bool) {
|
|
|
|
for _, _skipName := range SkipNames {
|
|
|
|
if _skipName == _name {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, _skipPrefix := range SkipPrefixes {
|
|
|
|
if strings.HasPrefix (_name, _skipPrefix) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, _skipSuffix := range SkipSuffixes {
|
|
|
|
if strings.HasSuffix (_name, _skipSuffix) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, _skipInfix := range SkipInfixes {
|
|
|
|
if strings.Contains (_name, _skipInfix) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|