From 3b0b76d92fc104eaafdbaa908138fe29900af8b7 Mon Sep 17 00:00:00 2001 From: lovetox Date: Mon, 26 Apr 2021 15:38:27 +0200 Subject: [PATCH] [preview] Handly encoded URIs correctly --- url_image_preview/url_image_preview.py | 3 +-- url_image_preview/utils.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/url_image_preview/url_image_preview.py b/url_image_preview/url_image_preview.py index 1c4edd6..dbe89d5 100644 --- a/url_image_preview/url_image_preview.py +++ b/url_image_preview/url_image_preview.py @@ -21,7 +21,6 @@ import mimetypes from pathlib import Path from functools import partial from urllib.parse import urlparse -from urllib.parse import unquote import gi from gi.repository import Gtk @@ -232,7 +231,7 @@ class UrlImagePreviewPlugin(GajimPlugin): return uri = text - urlparts = urlparse(unquote(uri)) + urlparts = urlparse(uri) if not self._accept_uri(urlparts, uri, additional_data): return diff --git a/url_image_preview/utils.py b/url_image_preview/utils.py index ef4c455..a8ec495 100644 --- a/url_image_preview/utils.py +++ b/url_image_preview/utils.py @@ -259,7 +259,7 @@ def parse_fragment(fragment): def get_image_paths(uri, urlparts, size, orig_dir, thumb_dir): - path = Path(urlparts.path) + path = Path(unquote(urlparts.path)) web_stem = path.stem extension = path.suffix