mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-27 21:17:50 +08:00
fix: error mount
This commit is contained in:
@@ -100,11 +100,16 @@ func (b *Base) Upload(destDir string, tryLink, detectMime, changeMediaHash bool,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
rel, err := filepath.Rel(b.src, path)
|
rel, err := filepath.Rel(b.src, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "relation between %s and %s", b.src, path)
|
return errors.Wrapf(err, "relation between %s and %s", b.src, path)
|
||||||
}
|
}
|
||||||
destName := filepath.Join(targetBase, rel)
|
destName := filepath.Clean(filepath.Join(targetBase, rel))
|
||||||
|
if !strings.HasPrefix(destName, targetBase) {
|
||||||
|
//如果目标路径不是在目标目录下,则报错
|
||||||
|
return errors.Errorf("destination: %s is not in target dir: %s", destName, targetBase)
|
||||||
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
mkdir(destName)
|
mkdir(destName)
|
||||||
|
|||||||
Reference in New Issue
Block a user