/
githubmirror
/
gogs
Обзор
Документация
Войти
/
githubmirror
/
gogs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.12.9
internal/pathutil/pathutil.go
17 строк
437 B
Joe Chen
pathutil: check both styles of `os.PathSeparator` (#7020)
07 июн 2022, 16:25
Не верифицирован
07 июн 2022, 16:25
20923a8
Код
Авторство
О чём код?
// Copyright 2020 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package pathutil import ( "path" "strings" ) // Clean cleans up given path and returns a relative path that goes straight // down to prevent path traversal. func Clean(p string) string { p = strings.ReplaceAll(p, `\`, "/") return strings.Trim(path.Clean("/"+p), "/") }