From 32f93f76ee50f24a4760d017393a4e6a40540332 Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Wed, 10 Sep 2025 21:24:42 +0200 Subject: [PATCH] Replace spaces in filenames, and sanatise all other extended utf8 --- hub/upload_confirm.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hub/upload_confirm.php b/hub/upload_confirm.php index 72133c0..3b1a62c 100755 --- a/hub/upload_confirm.php +++ b/hub/upload_confirm.php @@ -361,7 +361,11 @@ it with the HPR Volunteer at admin@hackerpublicradio.org foreach($_FILES["media_files"]["tmp_name"] as $key => $val) { if ( $_FILES["media_files"]["error"][ "$key"] == 0 ) { $from = $_FILES["media_files"]["tmp_name"][ "$key"]; - $to = "${dir_structure}/${db_key}_" . rawurlencode( $_FILES["media_files"]["name"][ "$key"] ); + $to = $_FILES["media_files"]["name"][ "$key"]; + $to = rawurlencode( "${to}" ); + $to = str_replace("%20","_",$to); + $to = str_replace("%","~",$to); + $to = "${dir_structure}/${db_key}_${to}"; $moveResult = move_uploaded_file($from, $to); if ($moveResult != true) { echo "ERROR: File not moved correctly >$from< >$to<";