fix: oci pull directory conflict when download twice (#914)

* fix: oci pull directory conflict when download twice

Signed-off-by: yxxhero <aiopsclub@163.com>

* add test cases
This commit is contained in:
yxxhero
2023-07-23 21:10:03 +08:00
committed by GitHub
parent d44b94cd68
commit 67ab08ab5e
6 changed files with 40 additions and 15 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"net/http/httptest"
"os"
"path"
"path/filepath"
"regexp"
"testing"
)
@@ -55,9 +55,9 @@ func TestDownloadfile(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
dir := t.TempDir()
downfile := path.Join(dir, "down.txt")
downfile := filepath.Join(dir, "down.txt")
if c.filepath != "" {
downfile = path.Join(dir, c.filepath)
downfile = filepath.Join(dir, c.filepath)
}
ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {