diff --git a/gajim/common/config.py b/gajim/common/config.py index 72e68f9b7a67aaf9f4756fbbd39fcb36846672cc..a03609fa0a6f3d6fe37fee2fb0fb349a3e47df5a 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -346,6 +346,7 @@ class Config: 'opened_chat_controls': [opt_str, '', _('List of XMPP Addresses (space separated) for which the chat window will be re-opened on next startup.')], 'recent_groupchats': [opt_str, ''], 'httpupload_verify': [opt_bool, True, _('HTTP File Upload: Enable HTTPS Verification.')], + 'httpupload_obfuscate_filename': [opt_bool, False, _('HTTP File Upload: Obfuscate (sha1) the name of the file uploaded to a server.')], 'filetransfer_preference' : [opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on a chat window. Can be \'httpupload\' (default) or \'jingle\'.')], 'allow_posh': [opt_bool, True, _('Allow certificate verification with POSH.')], }, {}), diff --git a/gajim/common/modules/httpupload.py b/gajim/common/modules/httpupload.py index 4206f9533577bf04670faa1ef22ff1eb3713c1e7..b6559c7fe520988a698ffb249d2203a236be60c5 100644 --- a/gajim/common/modules/httpupload.py +++ b/gajim/common/modules/httpupload.py @@ -19,6 +19,7 @@ import io from urllib.parse import urlparse import mimetypes +import hashlib from nbxmpp import NS_HTTPUPLOAD_0 from nbxmpp.util import is_error_result @@ -354,7 +355,12 @@ def set_uri_transform_func(self, func): @property def filename(self): - return os.path.basename(self._path) + basename = os.path.basename(self._path) + if app.config.get_per('accounts', + self._account, + 'httpupload_obf_fn'): + basename = hashlib.sha1(basename.encode('utf-8')).hexdigest() + return basename def set_error(self, text=''): self._close()