summaryrefslogtreecommitdiffstats
path: root/plugins/samples
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-07 11:53:43 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-07 11:53:43 +0200
commit94a5b505f7ef7760fcfa7b824ee49758eb63a9e8 (patch)
treed16ce96ae81e08d1b157461f1e168c3ee00f7f40 /plugins/samples
parentfc19b7d7974f9c64dffc40e180464d595a9805cd (diff)
fix file posting
Change-Id: If7e0aa3122af3a308a8441b518021f8a5cbe9473 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'plugins/samples')
-rw-r--r--plugins/samples/HelloWorld.c3
-rw-r--r--plugins/samples/SamplePost.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/samples/HelloWorld.c b/plugins/samples/HelloWorld.c
index fd780e20..e29c22fa 100644
--- a/plugins/samples/HelloWorld.c
+++ b/plugins/samples/HelloWorld.c
@@ -29,7 +29,8 @@ static int fillargs(json_object *args, struct afb_arg arg)
obj = json_object_new_object();
json_object_object_add (obj, "value", json_object_new_string(arg.value));
- json_object_object_add (obj, "path", json_object_new_string(arg.path));
+ if (arg.path != NULL)
+ json_object_object_add (obj, "path", json_object_new_string(arg.path));
json_object_object_add (obj, "size", json_object_new_int64((int64_t)arg.size));
json_object_object_add (args, arg.name && *arg.name ? arg.name : "<empty-string>", obj);
return 1; /* continue to iterate */
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index 58a2a8b8..8a1b477a 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -31,7 +31,8 @@ static int fillargs(json_object *args, struct afb_arg arg)
obj = json_object_new_object();
json_object_object_add (obj, "value", json_object_new_string(arg.value));
- json_object_object_add (obj, "path", json_object_new_string(arg.path));
+ if (arg.path != NULL)
+ json_object_object_add (obj, "path", json_object_new_string(arg.path));
json_object_object_add (obj, "size", json_object_new_int64((int64_t)arg.size));
json_object_object_add (args, arg.name && *arg.name ? arg.name : "<empty-string>", obj);
return 1; /* continue to iterate */