-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(local): directory handle (#2262)
* fix(local): check symlink dir * fix(local): set size of dir to 0 (close #2264)
- Loading branch information
Showing
2 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
package local | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func isSymlinkDir(f fs.FileInfo, path string) bool { | ||
if f.Mode()&os.ModeSymlink == os.ModeSymlink { | ||
dst, err := os.Readlink(filepath.Join(path, f.Name())) | ||
if err != nil { | ||
return false | ||
} | ||
stat, err := os.Stat(dst) | ||
if err != nil { | ||
return false | ||
} | ||
return stat.IsDir() | ||
} | ||
return false | ||
} |