mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
fix(repo): clean the path before using it
no issue detected but it's good to be safe
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
repo "github.com/jbenet/go-ipfs/repo"
|
repo "github.com/jbenet/go-ipfs/repo"
|
||||||
@ -42,10 +43,10 @@ type FSRepo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// At returns a handle to an FSRepo at the provided |path|.
|
// At returns a handle to an FSRepo at the provided |path|.
|
||||||
func At(path string) *FSRepo {
|
func At(repoPath string) *FSRepo {
|
||||||
// This method must not have side-effects.
|
// This method must not have side-effects.
|
||||||
return &FSRepo{
|
return &FSRepo{
|
||||||
path: path,
|
path: path.Clean(repoPath),
|
||||||
state: unopened, // explicitly set for clarity
|
state: unopened, // explicitly set for clarity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user