[evolution/gnome-3-38] I#1213 - EFileRequest: URL-decode path of the file before using it
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-38] I#1213 - EFileRequest: URL-decode path of the file before using it
- Date: Mon, 9 Nov 2020 12:37:55 +0000 (UTC)
commit e1b0310d65caf624d393a9ff099c49752cc1fa2b
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 9 13:35:33 2020 +0100
I#1213 - EFileRequest: URL-decode path of the file before using it
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1213
src/e-util/e-file-request.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/e-util/e-file-request.c b/src/e-util/e-file-request.c
index 090f8cf100..4dfe3e20cf 100644
--- a/src/e-util/e-file-request.c
+++ b/src/e-util/e-file-request.c
@@ -59,7 +59,7 @@ e_file_request_process_sync (EContentRequest *request,
GFileInputStream *file_input_stream;
GFileInfo *info;
goffset total_size;
- gchar *filename = NULL;
+ gchar *filename = NULL, *path;
SoupURI *suri;
g_return_val_if_fail (E_IS_FILE_REQUEST (request), FALSE);
@@ -71,13 +71,15 @@ e_file_request_process_sync (EContentRequest *request,
suri = soup_uri_new (uri);
g_return_val_if_fail (suri != NULL, FALSE);
+ path = soup_uri_decode (suri->path ? suri->path : "");
+
if (g_strcmp0 (suri->host, "$EVOLUTION_WEBKITDATADIR") == 0) {
- filename = g_build_filename (EVOLUTION_WEBKITDATADIR, suri->path, NULL);
+ filename = g_build_filename (EVOLUTION_WEBKITDATADIR, path, NULL);
} else if (g_strcmp0 (suri->host, "$EVOLUTION_IMAGESDIR") == 0) {
- filename = g_build_filename (EVOLUTION_IMAGESDIR, suri->path, NULL);
+ filename = g_build_filename (EVOLUTION_IMAGESDIR, path, NULL);
}
- file = g_file_new_for_path (filename ? filename : suri->path);
+ file = g_file_new_for_path (filename ? filename : path);
file_input_stream = g_file_read (file, cancellable, error);
if (file_input_stream) {
@@ -104,7 +106,7 @@ e_file_request_process_sync (EContentRequest *request,
if (file_input_stream) {
*out_stream = G_INPUT_STREAM (file_input_stream);
*out_stream_length = (gint64) total_size;
- *out_mime_type = g_content_type_guess (filename ? filename : suri->path, NULL, 0, NULL);
+ *out_mime_type = g_content_type_guess (filename ? filename : path, NULL, 0, NULL);
} else {
*out_stream = NULL;
*out_stream_length = (gint64) total_size;
@@ -114,6 +116,7 @@ e_file_request_process_sync (EContentRequest *request,
g_object_unref (file);
soup_uri_free (suri);
g_free (filename);
+ g_free (path);
return file_input_stream != NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]