chore: optimize standardize path

This commit is contained in:
Noah Hsu
2022-06-23 17:04:37 +08:00
parent a65dcb48b4
commit ffa0bc294a
5 changed files with 24 additions and 12 deletions

View File

@ -15,13 +15,13 @@ func ActualPath(account driver.Additional, rawPath string) string {
if i, ok := account.(driver.IRootFolderPath); ok {
rawPath = stdpath.Join(i.GetRootFolderPath(), rawPath)
}
return utils.StandardizationPath(rawPath)
return utils.StandardizePath(rawPath)
}
// GetAccountAndActualPath Get the corresponding account
// for path: remove the virtual path prefix and join the actual root folder if exists
func GetAccountAndActualPath(rawPath string) (driver.Driver, string, error) {
rawPath = utils.StandardizationPath(rawPath)
rawPath = utils.StandardizePath(rawPath)
if strings.Contains(rawPath, "..") {
return nil, "", errors.WithStack(errs.RelativePath)
}