1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
Daniel Neto 2024-09-20 10:53:11 -03:00
parent 5dd6792568
commit cc0d505e16

View file

@ -116,7 +116,7 @@ function cleanupDownloadsDirectory($resolution = 720)
$filePath = $directory . '/' . $entry;
// Check if it's a file and does not match the resolution pattern (e.g., '480_.mp4')
if (is_file($filePath) && !preg_match('/' . $resolution . '_\.mp4$/', $entry)) {
if (is_file($filePath) && (preg_match('/' . $resolution . '_\.mp4$/', $entry) || empty(filesize($filePath)))) {
// Attempt to delete the file
if (unlink($filePath)) {
_error_log("cleanupDownloadsDirectory: Deleted file: {$filePath}");