Commit 0f1dc5cc authored by Frank Bergmann's avatar Frank Bergmann

- Fixed SHA1 calculation for files who didn't get it from the client

parent 8b2df8e5
......@@ -110,6 +110,19 @@ db_foreach files $sql {
if {"" eq $version_type_id} { set version_type_id [im_file_type_default] }
if {"" eq $revision_id} { set revision_id 0 }
if {"" eq $content_length} { set content_length 0 }
if {"" eq $version_sha1 && 0 ne $revision_id} {
# needed to calculate sha1 for an "old" file
set storage_area_key "CR_FILES"
set storage_area_path [cr_fs_path $storage_area_key]
ns_log Debug "file-tree.json.tcl: storage_area_key($storage_area_key) storage_area_path($storage_area_path)"
set filename [db_string filename "select :storage_area_path || content from cr_revisions where revision_id = :revision_id"]
ns_log Notice "file-tree.json: Calculating sha1 for file=$filename"
set version_sha1 [string range [exec /usr/bin/sha1sum "$filename"] 0 39]
ns_log Notice "file-tree.json: Calculating sha1 for file=$filename: $version_sha1"
}
set version_list [list]
if {[info exists version_hash($file_id)]} { set version_list $version_hash($file_id) }
lappend version_list "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment