Index: openacs-4/packages/file-storage/file-storage.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v
diff -u -r1.60.2.27 -r1.60.2.28
--- openacs-4/packages/file-storage/file-storage.info 25 Feb 2024 17:29:22 -0000 1.60.2.27
+++ openacs-4/packages/file-storage/file-storage.info 26 Feb 2024 15:05:29 -0000 1.60.2.28
@@ -7,7 +7,7 @@
f
f
-
+
OpenACS
Collaborative document storage
2023-02-23
@@ -17,7 +17,7 @@
2
#file-storage.file-storage#
-
+
@@ -40,8 +40,6 @@
-
-
Index: openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl,v
diff -u -r1.17.2.1 -r1.17.2.2
--- openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl 15 Feb 2023 17:00:52 -0000 1.17.2.1
+++ openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl 26 Feb 2024 15:05:29 -0000 1.17.2.2
@@ -175,6 +175,20 @@
}
}
}
+ 5.10.1b2 5.10.1b3 {
+ #
+ # This upgrade is optional, as we do not want to
+ # delete user data just before a release. Uncomment
+ # these lines or otherwise run this snippet to get rid
+ # of 2 legacy parameters.
+ #
+ # apm_parameter_unregister \
+ # -package_key file-storage \
+ # -parameter ArchiveCommand
+ # apm_parameter_unregister \
+ # -package_key file-storage \
+ # -parameter ArchiveExtension
+ }
}
}
Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v
diff -u -r1.90.2.40 -r1.90.2.41
--- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 17 Mar 2023 15:15:18 -0000 1.90.2.40
+++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 26 Feb 2024 15:05:29 -0000 1.90.2.41
@@ -712,7 +712,7 @@
return $full_filename
}
-ad_proc -public fs::get_archive_command {
+ad_proc -deprecated fs::get_archive_command {
{-in_file ""}
{-out_file ""}
} {
Index: openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl,v
diff -u -r1.10.2.27 -r1.10.2.28
--- openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl 20 Apr 2023 14:47:36 -0000 1.10.2.27
+++ openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl 26 Feb 2024 15:05:29 -0000 1.10.2.28
@@ -214,52 +214,6 @@
aa_register_case \
-cats {api smoke} \
-procs {
- fs::get_archive_command
- } \
- fs_archive_api {
-
- Test api concerning archiving
-
- } {
- set orig_package_key [ad_conn package_key]
- set orig_package_id [ad_conn package_id]
-
- try {
- set wfd [ad_opentmpfile in_file .in]
- set out_file [file rootname $in_file].out
-
- puts $wfd abcd
- close $wfd
- set in_file_hash [ns_md file $in_file]
-
- #
- # We simulate a file-storage connection context
- #
- ad_conn -set package_key "file-storage"
- ad_conn -set package_id [db_string get_fs_is {
- select max(package_id) from apm_packages
- where package_key = 'file-storage'
- }]
-
- exec -ignorestderr {*}[fs::get_archive_command \
- -in_file $in_file \
- -out_file $out_file]
-
- aa_equals "Input file was untouched" \
- [ns_md file $in_file] $in_file_hash
-
- aa_true "Archive '$out_file' was generated" \
- [file exists $out_file]
- } finally {
- ad_conn -set package_key $orig_package_key
- ad_conn -set package_id $orig_package_id
- file delete -- $in_file $out_file
- }
- }
-
-aa_register_case \
- -cats {api smoke} \
- -procs {
fs::new_root_folder
fs::new_folder
fs::add_file
Index: openacs-4/packages/file-storage/www/download-archive/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/download-archive/index.vuh,v
diff -u -r1.8.2.3 -r1.8.2.4
--- openacs-4/packages/file-storage/www/download-archive/index.vuh 17 Mar 2023 13:29:05 -0000 1.8.2.3
+++ openacs-4/packages/file-storage/www/download-archive/index.vuh 26 Feb 2024 15:05:29 -0000 1.8.2.4
@@ -1,70 +1,37 @@
-# -*- Tcl -*-
-# file-storage/www/download-archive/index.vuh
-
ad_page_contract {
+ Download a file-storage object as an archive.
+
+ Note: before 26-02-2024 this page offered, via package parameters,
+ to customize the type and extension of the archive. It would also
+ allow to rename the dowloaded archive arbitrarily by manipulating
+ the request URL,
+ e.g. "/file-storage/download-archive/{object_id}/{download_name}".
+
+ We decided to disable both parameter customization and filename
+ manipulation. Instead, this page will now simply redirect to
+ www/download-zip, which apart from the two aforementioned
+ features, will behave the same. The download name will now always
+ be the "real" (and sanititzed) name of the object, while the
+ archive type and extension will always be zip. Calls to this URL
+ that were not relying on the two features (e.g. expecting a
+ specific file type) should not be affected.
+
@author yon@openforce.net
@creation-date 2002-05-21
@version $Id$
-} -query {
- {object_id:naturalnum,optional}
+} {
+ {object_id:object_id ""}
}
-if {[info exists object_id] && $object_id ne ""} {
- set download_name [fs::get_file_system_safe_object_name -object_id $object_id]
- set ext [parameter::get -parameter ArchiveExtension -default "txt"]
- if {$ext ne ""} {
- append download_name ".${ext}"
- }
-
- ad_returnredirect "${object_id}/${download_name}"
- ad_script_abort
+if {$object_id eq ""} {
+ set object_id [ad_urlencode [lindex [split [ad_conn path_info] /] 0]]
}
-# convenient way to get the values out of a list
-lassign [split [ad_conn path_info] /] object_id download_name
+ad_returnredirect ../download-zip?object_id=$object_id
+ad_script_abort
-# The assignment above might not set the object_id, so set it to a
-# value in that case such it will fail in the object_p test below.
-if {![info exists object_id]} {
- set object_id ""
-}
-
-if {![fs::object_p -object_id $object_id]} {
- ad_return_complaint 1 "Object \#$object_id is not a file storage object."
- ad_script_abort
-}
-
-set user_id [ad_conn user_id]
-if {$user_id == 0} {
- set user_id ""
-}
-
-# publish the object to the file system
-set in_path [ad_mktmpdir]
-
-set file [fs::publish_object_to_file_system -object_id $object_id -path $in_path -user_id $user_id]
-set file_name [file tail $file]
-
-# create a temp dir to put the archive in
-set out_path [ad_mktmpdir]
-
-set out_file [file join ${out_path} ${download_name}]
-
-# get the archive command
-set cmd [fs::get_archive_command -in_file $file_name -out_file $out_file]
-
-# create the archive
-exec bash -c "cd $in_path; $cmd; cd -"
-
-# return the archive to the connection.
-ns_returnfile 200 application/octet-stream $out_file
-
-# clean everything up
-file delete -force $in_path
-file delete -force $out_path
-
# Local variables:
# mode: tcl
# tcl-indent-level: 4