Handle relative system temporary directories

This commit is contained in:
2026-10-06 01:10:25 +00:00
parent ce3a85e3e6
commit f4d9cf20ec
3 changed files with 61 additions and 1 deletions

View File

@@ -14,6 +14,12 @@ func Outside(repositoryDir, pattern string) (string, error) {
if err != nil {
return "", err
}
absolute, err := filepath.Abs(directory)
if err != nil {
os.RemoveAll(directory)
return "", err
}
directory = absolute
repository, err := filepath.Abs(repositoryDir)
if err == nil && !strings.EqualFold(filepath.VolumeName(repository), filepath.VolumeName(directory)) {
return directory, nil