aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/afm-main-plugin
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-01-26 16:35:37 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-01-26 16:35:37 +0100
commitd5836c2c45c63cb627d1a72591e1f47f8e229aad (patch)
treeb2c49556eca9f0dc29d9364e71d7f95864465a65 /plugins/afm-main-plugin
parentf1a75365067fb89dd293aa2c8e003c3b041a3c9a (diff)
fixe getPostPath for afm-mail plugin
Diffstat (limited to 'plugins/afm-main-plugin')
-rw-r--r--plugins/afm-main-plugin/afm-main-plugin.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/plugins/afm-main-plugin/afm-main-plugin.c b/plugins/afm-main-plugin/afm-main-plugin.c
index 12bd9f33..5315da9d 100644
--- a/plugins/afm-main-plugin/afm-main-plugin.c
+++ b/plugins/afm-main-plugin/afm-main-plugin.c
@@ -127,20 +127,23 @@ static struct json_object *call_file__appid(AFB_request *request, AFB_PostItem *
struct json_object *obj;
char *query;
const char *filename = getPostPath(request);
- request->jresp = NULL;
- if (0 >= asprintf(&query, "\"%s\"", filename))
- request->errcode = MHD_HTTP_INTERNAL_SERVER_ERROR;
- else {
- obj = jbus_call_sj_sync(jbus, request->api, query);
- free(query);
- if (obj)
- request->jresp = embed(request, _id_, obj);
- else
- request->errcode = MHD_HTTP_FAILED_DEPENDENCY;
- }
- unlink(filename);
+
+ if (filename != NULL) {
+ request->jresp = NULL;
+ if (0 >= asprintf(&query, "\"%s\"", filename))
+ request->errcode = MHD_HTTP_INTERNAL_SERVER_ERROR;
+ else {
+ obj = jbus_call_sj_sync(jbus, request->api, query);
+ free(query);
+ if (obj)
+ request->jresp = embed(request, _id_, obj);
+ else
+ request->errcode = MHD_HTTP_FAILED_DEPENDENCY;
+ }
+ unlink(filename);
+ }
}
- return getPostFile (request, item, "/tmp");
+ return getPostFile (request, item, "/tmp/upload");
}
static AFB_restapi plug_apis[] =