video: ensure no trailing slash in govod temp dir

pull/391/head
Varun Patil 2023-01-31 19:39:57 -08:00
parent 8ff3bf0f4d
commit ecc6510713
1 changed files with 7 additions and 2 deletions

View File

@ -249,11 +249,16 @@ class VideoController extends ApiBase
shell_exec("rm -rf '{$tmpPath}'");
mkdir($tmpPath, 0755, true);
// Remove trailing slash from temp path if present
if ('/' === substr($tmpPath, -1)) {
$tmpPath = substr($tmpPath, 0, -1);
}
array_push($env, "GOVOD_TEMPDIR='{$tmpPath}'");
// Check if already running
$env = implode(' ', $env);
// Kill already running and start new
\OCA\Memories\Util::pkill($transcoder);
$env = implode(' ', $env);
shell_exec("{$env} nohup {$transcoder} > '{$tmpPath}.log' 2>&1 & > /dev/null");
// wait for 1s and try again