From aaa6b689b9fc56b1f8cfa5dd43ae9e3bd0a6e0e7 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 23 Apr 2024 16:54:46 -0700 Subject: [PATCH] Url-quote norm_path and use urljoin to attach the scheme. Assumes that if the path is already a URI it is also already quoted. Fixes #13218, #13197 --- gramps/gui/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gramps/gui/utils.py b/gramps/gui/utils.py index eb7ab2a75f1..33df7dff2ae 100644 --- a/gramps/gui/utils.py +++ b/gramps/gui/utils.py @@ -30,6 +30,7 @@ import os import sys import threading +from urllib.parse import urljoin, quote as urlquote # gtk is not included here, because this file is currently imported # by code that needs to run without the DISPLAY variable (eg, in @@ -506,7 +507,8 @@ def open_file_with_default_application(path, uistate): return if not norm_path.startswith("file://"): - norm_path = "file://" + norm_path + norm_path = urljoin("file://", urlquote(norm_path)) + try: Gio.AppInfo.launch_default_for_uri(norm_path) except GLib.Error as error: