Skip to content

Commit

Permalink
mode is not needed for symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Feb 10, 2025
1 parent 415e171 commit 31045a1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -194,7 +193,7 @@ func unzip(ctx context.Context, src, dest string, force bool) error {
}
if fi.Mode()&os.ModeSymlink != 0 {
// supports for symbolic link
if err := saveSymlinkIO(ctx, fpath, fc, f.Mode()); err != nil {
if err := saveSymlinkIO(ctx, fpath, fc); err != nil {
return err
}
} else {
Expand All @@ -208,14 +207,14 @@ func unzip(ctx context.Context, src, dest string, force bool) error {
return nil
}

func saveSymlinkIO(_ context.Context, fpath string, r io.ReadCloser, mode fs.FileMode) error {
func saveSymlinkIO(_ context.Context, fpath string, r io.ReadCloser) error {
defer r.Close()
l, err := io.ReadAll(r)
if err != nil {
return err
}
linkTo := string(l)
log.Printf("[debug] writing symlink %s -> %s mode %s", fpath, linkTo, mode)
log.Printf("[debug] writing symlink %s -> %s", fpath, linkTo)

cwd, err := os.Getwd()
if err != nil {
Expand Down

0 comments on commit 31045a1

Please sign in to comment.