From 36a73c04fd100aae1a533099f771d8469060c33d Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard@gmail.com>
Date: Thu, 28 Feb 2013 17:48:56 -0300
Subject: [PATCH] Calculate the md5 at write when a file is received - SL #4448
When a file is received after joining a colaboration session,
need be saved in the journal, and we need calculate the md5 hash.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
---
readactivity.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/readactivity.py b/readactivity.py
index 1481056..c7a81aa 100644
a
|
b
|
class ReadActivity(activity.Activity): |
144 | 144 | self._fileserver = None |
145 | 145 | self._object_id = handle.object_id |
146 | 146 | self._toc_model = None |
| 147 | self.filehash = None |
147 | 148 | |
148 | 149 | self.connect('key-press-event', self._key_press_event_cb) |
149 | 150 | self.connect('key-release-event', self._key_release_event_cb) |
… |
… |
class ReadActivity(activity.Activity): |
724 | 725 | self.metadata['Read_search'] = \ |
725 | 726 | self._edit_toolbar._search_entry.props.text |
726 | 727 | self.metadata['activity'] = self.get_bundle_id() |
727 | | self.metadata['filehash'] = self.filehash |
728 | 728 | |
729 | 729 | os.link(self._tempfile, file_path) |
| 730 | if self.filehash is None: |
| 731 | self.filehash = get_md5(file_path) |
| 732 | self.metadata['filehash'] = self.filehash |
730 | 733 | |
731 | 734 | if self._close_requested: |
732 | 735 | _logger.debug("Removing temp file %s because we will close", |