경로 문제 수정

This commit is contained in:
2023-05-28 21:21:37 +09:00
parent 49921d44ce
commit 18e7cbf75e
5 changed files with 10 additions and 9 deletions

View File

@ -85,8 +85,13 @@ func zipLogFiles(req *shared.UploadRequest, start, except string) (string, []str
return "", nil, nil
}
for i, file := range matches {
file = filepath.ToSlash(file)
matches[i] = file
}
root = path.Join(root, path.Dir(req.Filter))
zipFileName := path.Join(os.TempDir(), path.Base(matches[0]), ".zip")
zipFileName := path.Join(os.TempDir(), path.Base(matches[0])) + ".zip"
f, err := os.OpenFile(zipFileName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
if err != nil {
@ -98,9 +103,7 @@ func zipLogFiles(req *shared.UploadRequest, start, except string) (string, []str
defer w.Close()
oldestFile := ""
for i, file := range matches {
file = filepath.ToSlash(file)
matches[i] = file
for _, file := range matches {
if file == root {
continue
}