From 007fe04c08c604320a2654c1e378ec6617711416 Mon Sep 17 00:00:00 2001 From: gryf Date: Sat, 5 May 2018 16:13:13 +0200 Subject: [PATCH] Use as_uri only for absolute file paths, not random strings. --- slack_backup/reporters.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/slack_backup/reporters.py b/slack_backup/reporters.py index 77252dc..433b68a 100644 --- a/slack_backup/reporters.py +++ b/slack_backup/reporters.py @@ -225,12 +225,12 @@ class TextReporter(Reporter): """return data for file""" if msg.file.filepath: fpath = os.path.abspath(msg.file.filepath) + fpath = pathlib.PurePath(fpath).as_uri() else: fpath = 'does_not_exists' - return {'msg': self.url_pat.sub('(' + - pathlib.PurePath(fpath).as_uri() + - ') ' + msg.file.title, msg.text), + return {'msg': self.url_pat.sub('(' + fpath + ') ' + msg.file.title, + msg.text), 'nick': self._get_symbol('file')} def _msg(self, msg): @@ -381,16 +381,16 @@ class StaticHtmlReporter(Reporter): """return data for file""" if msg.file.filepath: fpath = os.path.abspath(msg.file.filepath) + fpath = pathlib.PurePath(fpath).as_uri() else: fpath = 'does_not_exists' _, ext = os.path.splitext(fpath) if ext.lower() in ('.png', '.jpg', '.jpeg', '.gif'): - url = ('' + msg.file.title + '') + url = ('' +
+                   msg.file.title + '') else: - url = ('' + msg.file.title + '') + url = ('' + msg.file.title + '') return {'msg': self.url_pat.sub(url, msg.text), 'nick': self._get_symbol('file')}