vinanrra / Docker-7DaysToDie

7 days to die server using LinuxGSM in Docker with backups, monitor, auto-installable mods and more
GNU General Public License v3.0
236 stars 47 forks source link

[BUG] mods_downloader.sh parse filename with line break #269

Open erdoking opened 3 months ago

erdoking commented 3 months ago

Describe the bug mods_downloader.sh parse filename with line break

To Reproduce Steps to reproduce the behavior: Set MODS_URLS="https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip"

Versions:

Additional context


Aug 22 01:13:30 gameserver-7days docker-7DaysToDie[72036]: INFO: Download successful: projectz-free-modpack-main.zip
Aug 22 01:13:30 gameserver-7days docker-7DaysToDie[72036]: WARNING: Unsupported file type. No extraction performed.
Aug 22 01:13:30 gameserver-7days docker-7DaysToDie[72036]: ERROR: Modinfo.xml not found in the extracted files.
tmp/test$ bash -x mods_downloader.sh
+ MODS_FOLDER=/tmp/test
+ MODS_URLS=https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip
+ mkdir -p /tmp/test
+ mkdir -p /tmp/test/tmp
++ echo https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip
++ sed -e 's/^ *//;s/ *$//'
++ tr -d '"'
+ MODS_URLS=https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip
+ IFS=', '
+ read -r -a urls
+ for url in "${urls[@]}"
++ curl -sIL https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip
++ grep -i -o -E 'content-disposition:.*filename="?([^"]*)"?'
++ sed -E 's/.*filename="?([^"]*)"?/\1/'
**+ filename=$'projectz-free-modpack-main.zip\r'**
+ '[' -z $'projectz-free-modpack-main.zip\r' ']'
 from https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip...'
 from https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip...
+ curl https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip -SsL -o $'projectz-free-modpack-main.zip\r'
+ '[' 0 -eq 0 ']'
' echo 'INFO: Download successful: projectz-free-modpack-main.zip
INFO: Download successful: projectz-free-modpack-main.zip
 == *.zip ]]z-free-modpack-main.zip
 == *.rar ]]z-free-modpack-main.zip
+ echo 'WARNING: Unsupported file type. No extraction performed.'
WARNING: Unsupported file type. No extraction performed.
++ find /tmp/test/tmp -type f -iname Modinfo.xml -exec dirname '{}' ';'
+ mod_folder=
++ basename ''
+ mod_folder_name=
+ '[' -n '' ']'
+ echo 'ERROR: Modinfo.xml not found in the extracted files.'
ERROR: Modinfo.xml not found in the extracted files.
 from https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip'
 from https://github.com/BlackRabbitMsk/projectz-free-modpack/archive/refs/heads/main.zip
+ rm -rf $'/tmp/test/tmp/projectz-free-modpack-main.zip\r'
+ rm -rf /tmp/test/tmp
+ echo 'All downloads, extractions, and folder movements completed.'
All downloads, extractions, and folder movements completed.