@@ -630,6 +630,8 @@ function move_track {
630630 local source=" $1 " # Source audio file
631631 local dest=" $2 " # Destination audio file
632632
633+ local IFS=$' \t\n ' # Set IFS to default
634+
633635 [ $flac2mp3_debug -ge 1 ] && echo " Debug|Moving/renaming track '$source ' to '$dest '" | log
634636 local result
635637 result=$( mv -f " $source " " $dest " )
@@ -926,6 +928,8 @@ function call_api {
926928 local endpoint=" $4 " # API endpoint to call
927929 local -a curl_data_args=() # Use array instead of string for safer argument passing
928930
931+ local IFS=$' \t\n ' # Set IFS to default
932+
929933 # Process remaining data values
930934 shift 4
931935 while (( "$# " )) ; do
@@ -1018,6 +1022,8 @@ function execute_ff_command {
10181022 local command=" $2 " # Full ffmpeg or ffprobe command to execute
10191023 local -a ff_args=() # Use array instead of string for safer argument passing
10201024
1025+ local IFS=$' \t\n ' # Set IFS to default
1026+
10211027 # Process remaining data values
10221028 shift 2
10231029 while (( "$# " )) ; do
@@ -1111,7 +1117,7 @@ function process_tracks {
11111117
11121118 # Changing the input field separator to split track string
11131119 declare -g flac2mp3_import_list=" "
1114- IFS=\|
1120+ local IFS=\|
11151121 for track in $flac2mp3_tracks ; do
11161122 # Check that track exists
11171123 if [ ! -f " $track " ]; then
@@ -1221,7 +1227,7 @@ function process_tracks {
12211227 # Convert the track
12221228 echo " Info|Writing: $newTrack " | log
12231229 local ffcommand=" nice /usr/bin/ffmpeg"
1224- IFS=$' \t\n ' # Temporarily restore IFS
1230+ local IFS=$' \t\n ' # Temporarily restore IFS
12251231 # shellcheck disable=SC2090
12261232 execute_ff_command " converting track: '$track ' to '$tempTrack '" " $ffcommand " -loglevel $flac2mp3_ffmpeg_log -nostdin -i " $track " $flac2mp3_ffmpeg_opts $metadata " $tempTrack "
12271233 local return=$? ; [ $return -ne 0 ] && {
@@ -1230,7 +1236,7 @@ function process_tracks {
12301236 [ -f " $tempTrack " ] && rm -f " $tempTrack "
12311237 continue
12321238 }
1233- IFS=\| # Go back to pipe IFS
1239+ local IFS=\| # Go back to pipe IFS
12341240
12351241 # Check for non-zero size file
12361242 if [ ! -s " $tempTrack " ]; then
@@ -1309,8 +1315,7 @@ function process_tracks {
13091315 # Add new track to list of tracks to import
13101316 flac2mp3_import_list+=" ${newTrack} |"
13111317 done
1312- # Restore IFS
1313- IFS=$' \t\n '
1318+
13141319 # Remove trailing pipe
13151320 flac2mp3_import_list=" ${flac2mp3_import_list% |} "
13161321 [ $flac2mp3_debug -ge 1 ] && echo " Debug|Track import list: $flac2mp3_import_list " | log
0 commit comments