From 82e263c2ab48bea24ef988bcef88132529eb71cc 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. 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. --- 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.9.1