aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/util_dataforms_spec.lua15
-rw-r--r--util/dataforms.lua2
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua
index 085128d1..ae6098be 100644
--- a/spec/util_dataforms_spec.lua
+++ b/spec/util_dataforms_spec.lua
@@ -106,6 +106,21 @@ describe("util.dataforms", function ()
name = "text-single-field",
value = "text-single-value",
},
+ {
+ -- XEP-0221
+ -- TODO Validate the XML produced by this.
+ type = "text-single",
+ label = "text-single-with-media-label",
+ name = "text-single-with-media-field",
+ media = {
+ height = 24,
+ width = 32,
+ {
+ type = "image/png",
+ uri = "data:",
+ },
+ },
+ },
});
xform = some_form:form();
end);
diff --git a/util/dataforms.lua b/util/dataforms.lua
index 052d6a55..449c1a58 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -136,7 +136,7 @@ function form_t.form(layout, data, formtype)
local media = field.media;
if media then
- form:tag("media", { xmlns = "urn:xmpp:media-element", height = media.height, width = media.width });
+ form:tag("media", { xmlns = "urn:xmpp:media-element", height = ("%g"):format(media.height), width = ("%g"):format(media.width) });
for _, val in ipairs(media) do
form:tag("uri", { type = val.type }):text(val.uri):up()
end