Commit 5029261f authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[omemo] Correctly decrypt encoded URIs

Fixes #528
parent 3becbc01
......@@ -18,7 +18,8 @@ import hashlib
import logging
import binascii
from pathlib import Path
from urllib.parse import urlparse, unquote
from urllib.parse import urlparse
from urllib.parse import unquote
from gi.repository import GLib
from gi.repository import Soup
......@@ -53,7 +54,7 @@ class FileDecryption:
self.window = window
urlparts = urlparse(unquote(
urlparts = urlparse(
if urlparts.scheme != 'aesgcm':'URL not encrypted: %s',
......@@ -106,6 +107,10 @@ class FileDecryption:
def _on_got_chunk(self, message, chunk, transfer):
if transfer.size:
# This gets called even when the requested file is not found
# So only update the progress if the file was actually found and
# we know the size
......@@ -119,6 +124,7 @@ class FileDecryption:
if message.status_code != Soup.Status.OK:
log.warning('Download failed: %s', transfer.request_uri)
transfer.set_error('http-error', 'Download failed: %s', transfer.request_uri)
data = message.props.response_body_data.get_data()
......@@ -187,7 +193,7 @@ class FileDecryption:
def _get_file_path(uri, urlparts):
path = Path(urlparts.path)
path = Path(unquote(urlparts.path))
stem = path.stem
extension = path.suffix
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment