aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-04-23 14:20:30 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-04-29 23:02:48 +0200
commit4006d07222511b94fd84aa4578a0b857a59639d5 (patch)
tree536342e718fa4c2e0efee1eaae12b7bff95f5e84 /global-functions.rsc
parent57ebcfb41cbd078ba62c7d4e7e921ffdae834521 (diff)
global-functions: $FetchHuge: remove temporary directory
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc9
1 files changed, 5 insertions, 4 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 66765bf..b0bde7e 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -406,13 +406,13 @@
:set CheckCert [ $IfThenElse ($CheckCert = false) "no" "yes-without-crl" ];
- :local FileName ("tmpfs/" . [ $CleanName $ScriptName ]);
- :if ([ $MkDir $FileName ] = false) do={
+ :local DirName ("tmpfs/" . [ $CleanName $ScriptName ]);
+ :if ([ $MkDir $DirName ] = false) do={
$LogPrint error $0 ("Failed creating directory!");
:return false;
}
- :set FileName ($FileName . "/" . [ $CleanName $0 ] . "-" . [ $GetRandom20CharAlNum ]);
+ :local FileName ($DirName . "/" . [ $CleanName $0 ] . "-" . [ $GetRandom20CharAlNum ]);
:do {
/tool/fetch check-certificate=$CheckCert $Url dst-path=$FileName \
http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) as-value;
@@ -421,6 +421,7 @@
/file/remove $FileName;
}
$LogPrint debug $0 ("Failed downloading from: " . $Url);
+ /file/remove $DirName;
:return false;
}
$WaitForFile $FileName;
@@ -432,7 +433,7 @@
:set Return ($Return . ([ /file/read offset=$VarSize chunk-size=32768 file=$FileName as-value ]->"data"));
:set VarSize [ :len $Return ];
}
- /file/remove $FileName;
+ /file/remove $DirName;
:return $Return;
}