Refactor permission setting in ChineseNfoRegistry to use sudo for improved security
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 11s
Docker Build & Deploy / Deploy to Production (push) Successful in 4s

This commit is contained in:
孙诚
2025-03-19 15:00:52 +08:00
parent f3a1b8be3f
commit 795937d052

View File

@@ -64,20 +64,14 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
var failedCount = 0;
var skippedCount = 0;
// 使用 chmod -R 666 设置全部文件的读写权限
var permission = new Process
// 使用 root 角色执行 chmod -R 666 设置全部文件的读写权限
var permission = new ProcessStartInfo("sudo", "chmod -R 666 " + tvFolder)
{
StartInfo = new ProcessStartInfo
{
FileName = "chmod",
Arguments = "-R 666 " + tvFolder,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
}
CreateNoWindow = true,
UseShellExecute = false
};
Process.Start(permission);
permission.Start();
// 扫描 tvshow.nfo 文件
var tvShowFiles = Directory.GetFiles(tvFolder, "tvshow.nfo", SearchOption.AllDirectories);