Ticket #3297 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

Cannot Delete MusicOnHold files contain space

Reported by: dinhtrung Assigned to:
Priority: trivial Milestone: 2.5
Component: Music On Hold Version: 2.5-branch
Keywords: Cc:
Confirmation: Confirmed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

If you choose a mp3 file like "03 - Beatles - Help", you can upload this successful to something like "origX_03 - Beatles - Help", but this file cannot be delete through web UI.

I change the code like this:

Index: page.music.php
===================================================================
--- page.music.php	(revision 6987)
+++ page.music.php	(working copy)
@@ -519,7 +519,7 @@
 		if (($numf == 1) && ($category == "default") ){
 			echo "<h5>"._("You must have at least one file for On Hold Music.  Please upload one before deleting this one.")."</h5>";
 		} else {
-			if (@unlink($path_to_dir."/".$del)) {
+			if (exec("rm -f ".$path_to_dir."/".$del."*")) {
 				echo "<h5>"._("Deleted")." ".$del."!</h5>";
 			} else {
 				echo "<h5>".sprintf(_("Error Deleting %s"),$del)."!</h5>";

By delete "origX_*" in the current directory. Don't know if this will make any conflicts. It is best to have another script process moh directory, and escape any invalid filename when uploading.

Change History

10/18/08 12:42:07 changed by p_lindheimer

  • confirmation changed from Unreviewed to Confirmed.
  • type changed from Patches to Bugs.

this - the patch NOT good and dangerous. It will delete everything that matches what is in $del*. The issue is not the unlink command, the bug is in the delete list, it's missing a urlencode:

Index: page.music.php
===================================================================
--- page.music.php      (revision 6971)
+++ page.music.php      (working copy)
@@ -183,7 +183,7 @@
                        print "<div style=\"text-align:right;width:550px;border: 1px solid;padding:2px;\">";
                        print "<b style=\"float:left;margin-left:5px;\" >".$thisfile."</b>";
 
-                       $delURL = $_SERVER['SCRIPT_NAME']."?display=".(isset($display)?$display:'')."&del=".$thisfile."&category=".$category;
+                       $delURL = $_SERVER['SCRIPT_NAME']."?display=".(isset($display)?$display:'')."&del=".urlencode($thisfile)."&category=".$category;
                        $tlabel = _("Delete");
                        $label = '<span><img width="16" height="16" border="0" title="'.$tlabel.'" alt="'.$tlabel.'" src="images/core_delete.png"/>&nbsp;</span>';
                        echo "<a style=\"margin-right:5px;\" href=".$delURL.">".$label."</a></div><br />";

but you are right, it is a bug:)

10/18/08 12:43:01 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

(In [7004]) fixes #3297 urlencode the file names in the delete list

10/18/08 12:45:37 changed by p_lindheimer

(In [7005]) fixes #3297 urlencode the file names in the delete list