From 80dd3c62ad9e19ad1d35b3b8cfb6824bad17b7cc Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 16 Apr 2014 20:49:02 -0400 Subject: [PATCH] Bug 6874 - id based on contents, filename, and directory. Content-Type: text/plain; charset=utf-8 This patch corrects the inability to upload the same file to a different directory, or even a renamed file to the same directory. By including the filename and directory as part of the $id SHA generation, only identical files in the same directory with the same file name will generate the same $id. Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Marcel de Rooy --- C4/UploadedFiles.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/UploadedFiles.pm b/C4/UploadedFiles.pm index 6248eaa..341b5b6 100644 --- a/C4/UploadedFiles.pm +++ b/C4/UploadedFiles.pm @@ -150,6 +150,8 @@ sub UploadFile { my $sha = new Digest::SHA; $sha->add($data); + $sha->add($filename); + $sha->add($dir); my $id = $sha->hexdigest; # Test if this id already exist -- 1.7.10.4