Index: openacs-4/packages/acs-templating/acs-templating.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/acs-templating.info,v
diff -u -r1.66.2.32 -r1.66.2.33
--- openacs-4/packages/acs-templating/acs-templating.info	25 Aug 2022 11:34:50 -0000	1.66.2.32
+++ openacs-4/packages/acs-templating/acs-templating.info	25 Aug 2022 12:45:56 -0000	1.66.2.33
@@ -9,7 +9,7 @@
     <implements-subsite-p>f</implements-subsite-p>
     <inherit-templates-p>t</inherit-templates-p>
 
-    <version name="5.10.1d14" url="http://openacs.org/repository/download/apm/acs-templating-5.10.1d14.apm">
+    <version name="5.10.1d15" url="http://openacs.org/repository/download/apm/acs-templating-5.10.1d15.apm">
         <owner url="http://openacs.org">OpenACS</owner>
         <summary>Templating library.</summary>
         <release-date>2021-09-15</release-date>
@@ -27,9 +27,9 @@
         <license>GPL version 2</license>
         <maturity>3</maturity>
 
-        <provides url="acs-templating" version="5.10.1d14"/>
+        <provides url="acs-templating" version="5.10.1d15"/>
         <requires url="acs-kernel" version="5.10.0"/>
-        <requires url="acs-tcl" version="5.10.1d20"/>
+        <requires url="acs-tcl" version="5.10.1d21"/>
 
         <callbacks>
             <callback type="before-upgrade"  proc="template::apm::before_upgrade"/>
Index: openacs-4/packages/acs-templating/tcl/file-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/file-procs.tcl,v
diff -u -r1.12.2.8 -r1.12.2.9
--- openacs-4/packages/acs-templating/tcl/file-procs.tcl	25 Aug 2022 11:37:12 -0000	1.12.2.8
+++ openacs-4/packages/acs-templating/tcl/file-procs.tcl	25 Aug 2022 12:45:56 -0000	1.12.2.9
@@ -110,7 +110,7 @@
         # file_transform.
         #
         set result 0
-    } elseif { ![security::safe_tmpfile_p [lindex $value 1]] } {
+    } elseif { ![security::safe_tmpfile_p -must_exist [lindex $value 1]] } {
         #
         # The tmpfile is not safe
         #
Index: openacs-4/packages/acs-templating/tcl/test/data-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/test/data-procs.tcl,v
diff -u -r1.1.2.28 -r1.1.2.29
--- openacs-4/packages/acs-templating/tcl/test/data-procs.tcl	25 Aug 2022 11:34:50 -0000	1.1.2.28
+++ openacs-4/packages/acs-templating/tcl/test/data-procs.tcl	25 Aug 2022 12:45:56 -0000	1.1.2.29
@@ -306,17 +306,30 @@
     @author Héctor Romojaro <hector.romojaro@gmail.com>
     @creation-date 28 June 2021
 } {
+    #
+    # A valid, existing tmpfile
+    #
+    set tmpfile [ad_tmpnam]
+    set wfd [open $tmpfile w]
+    puts $wfd 1234
+    close $wfd
 
-    set values {
-        my_file false
-        lalala false
-        {Afile /tmp/testfile text/plain} true
-        {A/file /tmp/testfile2 ""} false
-        {A/file /tmp/testfile2 a} true
-        {\\afile /tmp/testfile3 a} false
-        {afile /etc/passwd text/css} false
-    }
+    #
+    # A tmpfile that does not exist
+    #
+    set tmpfile_missing [ad_tmpnam]
 
+    set values [list \
+                    my_file false \
+                    lalala false \
+                    [list Afile $tmpfile text/plain] true \
+                    [list A/file $tmpfile ""] false \
+                    [list A/file $tmpfile a] true \
+                    [list A/file $tmpfile_missing a] false \
+                    [list \\afile $tmpfile a] false \
+                    {afile /etc/passwd text/css} false \
+                   ]
+
     set message ""
     foreach {value expected} $values {
         aa_$expected "Is $value a file?" \