check-certificates: use :convert for url-encoding

This commit is contained in:
Christian Hesse 2026-05-20 08:58:22 +02:00
parent ffbab5d9ed
commit 0b2f6eeb01

View file

@ -30,7 +30,6 @@
:global ScriptLock; :global ScriptLock;
:global SendNotification2; :global SendNotification2;
:global SymbolForNotification; :global SymbolForNotification;
:global UrlEncode;
:global WaitFullyConnected; :global WaitFullyConnected;
:local CheckCertificatesDownloadImport do={ :local CheckCertificatesDownloadImport do={
@ -46,11 +45,10 @@
:global FetchUserAgentStr; :global FetchUserAgentStr;
:global LogPrint; :global LogPrint;
:global RmFile; :global RmFile;
:global UrlEncode;
:global WaitForFile; :global WaitForFile;
:foreach Type in={ "p12"; "pem" } do={ :foreach Type in={ "p12"; "pem" } do={
:local CertFileName ([ $UrlEncode $FetchName ] . "." . $Type); :local CertFileName ([ :convert to=url $FetchName ] . "." . $Type);
$LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \ $LogPrint debug $ScriptName ("Trying type '" . $Type . "' for '" . $CertName . \
"' (file '" . $CertFileName . "')..."); "' (file '" . $CertFileName . "')...");
@ -202,7 +200,7 @@
} else={ } else={
$LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced."); $LogPrint debug $ScriptName ("Certificate '" . $CertVal->"name" . "' was not updated, but replaced.");
:local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ $UrlEncode $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \ :local CertNew [ /certificate/find where name~("^" . [ $EscapeForRegEx [ :convert to=url $FetchName ] ] . "\\.(p12|pem)_[0-9]+\$") \
(common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \ (common-name=($CertVal->"common-name") or subject-alt-name~("(^|\\W)(DNS|IP):" . [ $EscapeForRegEx $LastName ] . "(\\W|\$)")) \
fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ]; fingerprint!=[ :tostr ($CertVal->"fingerprint") ] ];
:local CertNewVal [ /certificate/get $CertNew ]; :local CertNewVal [ /certificate/get $CertNew ];