Software / code / prosody
Comparison
util/dataforms.lua @ 11026:a086825ed73a
util.dataforms: Convert media element sizes to avoid error on Lua 5.3
The stanza API does not accept number values and threw an error due to
the height and width attributes of the media element (XEP-0221).
This part had no test coverage previously, explaining why it was not
discovered until now.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 16 Aug 2020 12:55:55 +0200 |
| parent | 9246:397e8e5a2f1f |
| child | 11070:f7f30a3464fe |
comparison
equal
deleted
inserted
replaced
| 11025:e47e7185b403 | 11026:a086825ed73a |
|---|---|
| 134 end | 134 end |
| 135 end | 135 end |
| 136 | 136 |
| 137 local media = field.media; | 137 local media = field.media; |
| 138 if media then | 138 if media then |
| 139 form:tag("media", { xmlns = "urn:xmpp:media-element", height = media.height, width = media.width }); | 139 form:tag("media", { xmlns = "urn:xmpp:media-element", height = ("%g"):format(media.height), width = ("%g"):format(media.width) }); |
| 140 for _, val in ipairs(media) do | 140 for _, val in ipairs(media) do |
| 141 form:tag("uri", { type = val.type }):text(val.uri):up() | 141 form:tag("uri", { type = val.type }):text(val.uri):up() |
| 142 end | 142 end |
| 143 form:up(); | 143 form:up(); |
| 144 end | 144 end |