Skip to content
Myr

refactor(context):Avoid using filepath.Dir twice in SaveUploadedFile (#4181)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by NezhaFan · committed by GitHub · parent 1eb8272 · Browse files · 1 file+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: voyager1 <voyager1@voyager1deMacBook-Pro.local>

Diff stats

1 file+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:context.go+6 added-6 removed
682 unmodified lines
683 return err684 }685 defer src.Close()686687 if len(perm) <= 0 {688 perm = append(perm, 0o750)687 var mode os.FileMode = 0o750688 if len(perm) > 0 {689 mode = perm[0]690 }690691 if err = os.MkdirAll(filepath.Dir(dst), perm[0]); err != nil {691 dir := filepath.Dir(dst)692 if err = os.MkdirAll(dir, mode); err != nil {693 return err694 }694695 if err = os.Chmod(filepath.Dir(dst), perm[0]); err != nil {695 if err = os.Chmod(dir, mode); err != nil {696 return err697 }698699 out, err := os.Create(dst)
661 unmodified lines