[evolution-ews] Convert uri to filepath when creating attachments
- From: Or Goshen <ogosh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Convert uri to filepath when creating attachments
- Date: Thu, 16 Jun 2011 14:12:30 +0000 (UTC)
commit 9d53b7aad47155b6b4f4a3b18a2eba7aa382542e
Author: Or Goshen <orx goshen intel com>
Date: Thu Jun 16 17:24:35 2011 +0300
Convert uri to filepath when creating attachments
src/server/e-ews-connection.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index fca0684..b6ce69f 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -2757,17 +2757,17 @@ create_attachments_response_cb (ESoapParameter *param,
static void
e_ews_connection_attach_file (ESoapMessage *msg,
- const char *filepath)
+ const char *uri)
{
/* TODO - handle a situation where the file isnt accessible/other problem with it */
/* TODO - This is a naive implementation that just uploads the whole content into memory, ie very inefficient */
struct stat st;
- char *buffer;
+ char *buffer, *filepath;
const char *filename;
int fd;
- /* get over the "protocol" 'file://' */
- filepath += 7;
+ /* convert uri to actual file path */
+ filepath = g_filename_from_uri (uri, NULL, NULL);
if (stat (filepath, &st) == -1) {
g_warning ("Error while calling stat() on %s\n", filepath);
@@ -2775,6 +2775,7 @@ e_ews_connection_attach_file (ESoapMessage *msg,
}
fd = open (filepath, O_RDONLY);
+ free (filepath);
if (fd == -1) {
g_warning ("Error opening %s for reading\n", filepath);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]