Mercurial > libervia-backend
diff sat/plugins/plugin_comp_file_sharing.py @ 2929:e0429ff7f6b6
plugin comp file sharing: file sharing management first draft:
the new "component file sharing management" plugin add ad-hoc commands to changes permission of one or several shared files, delete one or more files, or regenerate thumbnails.
This is a temporary plugin to make file sharing through a component usable with other entities, but should be removed (at least permission management and file deletion) in the future if we move on a pubsub based solution.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Apr 2019 09:00:51 +0200 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_file_sharing.py Sun Apr 28 08:55:13 2019 +0200 +++ b/sat/plugins/plugin_comp_file_sharing.py Sun Apr 28 09:00:51 2019 +0200 @@ -44,6 +44,7 @@ C.PI_PROTOCOLS: [], C.PI_DEPENDENCIES: [ "FILE", + "FILE_SHARING_MANAGEMENT", "XEP-0231", "XEP-0234", "XEP-0260", @@ -219,6 +220,9 @@ # we only use the first found file found_file = found_files[0] + if found_file[u'type'] != C.FILE_TYPE_FILE: + raise TypeError(u"a file was expected, type is {type_}".format( + type_=found_file[u'type'])) file_hash = found_file[u"file_hash"] file_path = os.path.join(self.files_path, file_hash) file_data[u"hash_hasher"] = hasher = self._h.getHasher(found_file[u"hash_algo"])