google expects a valid user agent to deliver the ics file
Added test if downloaded file is a ics file
This commit is contained in:
@@ -77,13 +77,18 @@ icscheck() {
|
||||
|
||||
mkdir -p "${ics_temp_dir}" "${ics_store_dir}"
|
||||
|
||||
wget -O "$ics_down_file" "$ics_url" >/dev/null 2>&1
|
||||
curl -L "${ics_url}" -H "User-Agent: ${icsconf_useragent:?}" -o "${ics_down_file}" >/dev/null 2>&1
|
||||
|
||||
# -s : exists and size greater zero
|
||||
if [ ! -s "$ics_down_file" ] || [ ! -r "$ics_down_file" ]; then
|
||||
icsError
|
||||
exit 1
|
||||
fi
|
||||
# check if ics file has VEVENTs
|
||||
if ! grep -qE "(BEGIN:|END:)VEVENT" "${ics_down_file}"; then
|
||||
icsError
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete storage if manual renew is requested
|
||||
(( renew )) && rm -f "${ics_store_file}"
|
||||
|
Reference in New Issue
Block a user