]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix cutlist extension handling for filenames without dots
authorFlole <Flole998@users.noreply.github.com>
Sun, 8 Mar 2026 01:35:57 +0000 (02:35 +0100)
committerFlole <Flole998@users.noreply.github.com>
Sun, 8 Mar 2026 14:42:19 +0000 (15:42 +0100)
src/dvr/dvr_cutpoints.c

index a6beed28ebf4070ec2c27a735f8098ad9c6fabcc..ea55a254a61285f51a81df53bd29675df4725ff6 100644 (file)
@@ -319,9 +319,16 @@ dvr_cutpoint_delete_files (const char *s)
   for (i = 0; i < ARRAY_SIZE(dvr_cutpoint_parsers); i++) {
 
     strcpy(path, s);
-    if ((dot = (strrchr(path, '.') + 1)))
-      *dot = 0;
-
+    
+    dot = strrchr(path, '.');
+    if (dot && strchr(dot, '/')) dot = NULL; // Dot is in a directory, that doesn't count
+    if (dot) {
+      /* keep the dot, truncate after it */
+      *(dot + 1) = '\0';
+    } else {
+      /* add a dot so we get "base.ext" */
+      strcat(path, ".");
+    }
     strcat(path, dvr_cutpoint_parsers[i].ext);
 
     /* Check file exists */