File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,12 +169,24 @@ install_test_suite() {
169169 archive_url=" https://github.com/WordPress/wordpress-develop/archive/refs/tags/${ref} .tar.gz"
170170 fi
171171
172- download ${archive_url} $TMPDIR /wordpress-develop.tar.gz
173- tar -zxmf $TMPDIR /wordpress-develop.tar.gz -C $TMPDIR
174- mv $TMPDIR /wordpress-develop-${ref} /tests/phpunit/includes $WP_TESTS_DIR /
175- mv $TMPDIR /wordpress-develop-${ref} /tests/phpunit/data $WP_TESTS_DIR /
176- rm -rf $TMPDIR /wordpress-develop-${ref}
177- rm $TMPDIR /wordpress-develop.tar.gz
172+ download " ${archive_url} " " $TMPDIR /wordpress-develop.tar.gz"
173+
174+ # Validate that the tarball was downloaded correctly before extracting
175+ if [ ! -s " $TMPDIR /wordpress-develop.tar.gz" ]; then
176+ echo -e " ${RED} Error:${RESET} Downloaded test suite archive is missing or empty: $TMPDIR /wordpress-develop.tar.gz"
177+ exit 1
178+ fi
179+
180+ if ! tar -tzf " $TMPDIR /wordpress-develop.tar.gz" > /dev/null 2>&1 ; then
181+ echo -e " ${RED} Error:${RESET} Downloaded test suite archive is not a valid tar.gz file: $TMPDIR /wordpress-develop.tar.gz"
182+ exit 1
183+ fi
184+
185+ tar -zxmf " $TMPDIR /wordpress-develop.tar.gz" -C " $TMPDIR "
186+ mv " $TMPDIR /wordpress-develop-${ref} /tests/phpunit/includes" " $WP_TESTS_DIR " /
187+ mv " $TMPDIR /wordpress-develop-${ref} /tests/phpunit/data" " $WP_TESTS_DIR " /
188+ rm -rf " $TMPDIR /wordpress-develop-${ref} "
189+ rm " $TMPDIR /wordpress-develop.tar.gz"
178190 echo -e " ${GREEN} Test suite installed.${RESET} "
179191 else
180192 echo -e " ${CYAN} Test suite is already installed.${RESET} "
You can’t perform that action at this time.
0 commit comments