mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 04:53:09 +08:00
0d277b8550
* feat(strm): add local save permission mode - add private and shared permission modes for local STRM files - repair shared-mode directory and file permissions during generation - add permission handling tests Co-authored-by: Codex <267193182+codex@users.noreply.github.com> * fix(strm): respect deployment umask for local directories - remove application-level permission modes and chmod operations - create local STRM directories with umask-controlled permissions - preserve existing permissions and test the behavior Co-authored-by: Codex <267193182+codex@users.noreply.github.com> --------- Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
31 lines
700 B
Go
31 lines
700 B
Go
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
|
|
|
package strm
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"syscall"
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateLocalDirectoryRespectsUmask(t *testing.T) {
|
|
root := t.TempDir()
|
|
nested := filepath.Join(root, "library", "movie")
|
|
|
|
originalUmask := syscall.Umask(0o027)
|
|
defer syscall.Umask(originalUmask)
|
|
|
|
if err := createLocalDirectory(nested); err != nil {
|
|
t.Fatalf("createLocalDirectory() error = %v", err)
|
|
}
|
|
|
|
info, err := os.Stat(nested)
|
|
if err != nil {
|
|
t.Fatalf("stat created directory: %v", err)
|
|
}
|
|
if got := info.Mode().Perm(); got != 0o750 {
|
|
t.Errorf("created directory permissions = %#o, want %#o", got, 0o750)
|
|
}
|
|
}
|