(self, dir_inner_path, file_relative_path, optional=False)
| 582 | return diffs |
| 583 | |
| 584 | def hashFile(self, dir_inner_path, file_relative_path, optional=False): |
| 585 | back = {} |
| 586 | file_inner_path = dir_inner_path + "/" + file_relative_path |
| 587 | |
| 588 | file_path = self.site.storage.getPath(file_inner_path) |
| 589 | file_size = os.path.getsize(file_path) |
| 590 | sha512sum = CryptHash.sha512sum(file_path) # Calculate sha512 sum of file |
| 591 | if optional and not self.hashfield.hasHash(sha512sum): |
| 592 | self.optionalDownloaded(file_inner_path, self.hashfield.getHashId(sha512sum), file_size, own=True) |
| 593 | |
| 594 | back[file_relative_path] = {"sha512": sha512sum, "size": os.path.getsize(file_path)} |
| 595 | return back |
| 596 | |
| 597 | def isValidRelativePath(self, relative_path): |
| 598 | if ".." in relative_path.replace("\\", "/").split("/"): |
no test coverage detected