зеркало из https://github.com/Azure/draft-classic.git
trim leading and trailing backslashes from path on Windows
This is because we accept the following form: docs/ linguist-documentation
This commit is contained in:
Родитель
d03d9c07c8
Коммит
8ecec2b49f
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
@ -112,6 +113,10 @@ func initLinguistAttributes(dir string) error {
|
|||
continue
|
||||
}
|
||||
path := strings.Trim(words[0], string(filepath.Separator))
|
||||
if runtime.GOOS == "windows" {
|
||||
// on Windows, we also accept / as a path separator, so let's strip those as well
|
||||
path = strings.Trim(words[0], "/")
|
||||
}
|
||||
attribute := words[1]
|
||||
if strings.HasPrefix(attribute, "linguist-documentation") || strings.HasPrefix(attribute, "linguist-vendored") || strings.HasPrefix(attribute, "linguist-generated") {
|
||||
if !strings.HasSuffix(strings.ToLower(attribute), "false") {
|
||||
|
|
Загрузка…
Ссылка в новой задаче