Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.180.2.85 -r1.180.2.86
--- openacs-4/packages/xowiki/xowiki.info 8 Feb 2022 10:11:49 -0000 1.180.2.85
+++ openacs-4/packages/xowiki/xowiki.info 18 Feb 2022 18:32:28 -0000 1.180.2.86
@@ -10,7 +10,7 @@
t
xowiki
-
+
Gustaf Neumann
A xotcl-based enterprise wiki system with multiple object types
2021-09-15
@@ -55,11 +55,11 @@
BSD-Style
2
-
+
-
+
Index: openacs-4/packages/xowiki/tcl/import-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/import-procs.tcl,v
diff -u -r1.42.2.8 -r1.42.2.9
--- openacs-4/packages/xowiki/tcl/import-procs.tcl 17 Feb 2021 08:27:59 -0000 1.42.2.8
+++ openacs-4/packages/xowiki/tcl/import-procs.tcl 18 Feb 2022 18:32:28 -0000 1.42.2.9
@@ -398,26 +398,35 @@
}
ArchiveFile instproc unpack {} {
set success 0
- #:log "::xowiki::guesstype '${:name}' => [::xowiki::guesstype ${:name}]"
switch [::xowiki::guesstype ${:name}] {
application/zip -
application/x-zip -
application/x-zip-compressed {
- ::util::unzip -source ${:file} -destination ${:tmpdir}
- :import -dir ${:tmpdir} -parent_id ${:parent_id}
- set success 1
+ set success [util::file_content_check -type zip -file ${:file}]
+ if {!$success} {
+ util_user_message -message "The uploaded file is apparently not a zip file."
+ } else {
+ ::util::unzip -source ${:file} -destination ${:tmpdir}
+ :import -dir ${:tmpdir} -parent_id ${:parent_id}
+ }
}
application/x-compressed {
if {[string match "*tar.gz" ${:name}]} {
- set cmd [::util::which tar]
- exec $cmd -xzf ${:file} -C ${:tmpdir}
- :import -dir ${:tmpdir} -parent_id ${:parent_id}
- set success 1
+ set success [util::file_content_check -type gzip -file ${:file}]
+ if {!$success} {
+ util_user_message -message "The uploaded file is apparently not a gzip file."
+ } else {
+ set cmd [::util::which tar]
+ exec $cmd -xzf ${:file} -C ${:tmpdir}
+ :import -dir ${:tmpdir} -parent_id ${:parent_id}
+ }
} else {
- :msg "unknown compressed file type ${:name}"
+ util_user_message -message "Unknown compressed file type ${:name}."
}
}
- default {:msg "type [::xowiki::guesstype ${:name}] of ${:name} unknown"}
+ default {
+ util_user_message -message "Type '[::xowiki::guesstype ${:name}]' is not an supported archive format."
+ }
}
#:msg success=$success
return $success
Index: openacs-4/packages/xowiki/www/admin/import.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/import.tcl,v
diff -u -r1.28.2.6 -r1.28.2.7
--- openacs-4/packages/xowiki/www/admin/import.tcl 7 Oct 2020 10:09:42 -0000 1.28.2.6
+++ openacs-4/packages/xowiki/www/admin/import.tcl 18 Feb 2022 18:32:28 -0000 1.28.2.7
@@ -38,9 +38,19 @@
}
set upload_tmpfile [template::util::file::get_property tmp_filename $upload_file]
- set f [open $upload_tmpfile];
- # if we do not set translation binary,
+
+ set file_looks_ok [util::file_content_check -type export -file ${upload_tmpfile}]
+ if {!$file_looks_ok} {
+ template::form::set_error upload_form upload_file \
+ "The provided file is not in the export file format"
+ break
+ }
+
+ set f [open $upload_tmpfile]
+ #
+ # If we do not set translation binary,
# backslashes at the end of the lines might be lost
+ #
fconfigure $f -translation binary -encoding utf-8
set content [read $f]; close $f