From 887a08c289f3699eea610a7377116b16ff91697f Mon Sep 17 00:00:00 2001 From: Zxilly Date: Sat, 21 Sep 2024 18:26:38 +0800 Subject: [PATCH] syscall: add separator for filepath if contains "." in waspi Fix cases like "file/." --- src/syscall/fs_wasip1.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/syscall/fs_wasip1.go b/src/syscall/fs_wasip1.go index c249891dd21..2061b331964 100644 --- a/src/syscall/fs_wasip1.go +++ b/src/syscall/fs_wasip1.go @@ -409,6 +409,9 @@ func appendCleanPath(buf []byte, path string, lookupParent bool) ([]byte, bool) case "": continue case ".": + if len(buf) > 0 && buf[len(buf)-1] != '/' { + buf = append(buf, '/') + } continue case "..": if !lookupParent {