How to add attachments with Hex data
Description
A specific use case is being able to add attachments from an sql query that has image data using runFromSql. However, more generally, if the data from the attachment is represented as a hex string (like a hex dump), then a simple conversion to bytes can be done.
For example, the hex string '3132' becomes '12'.
Details
The hex string can be provided in the content parameter or by the file parameter. In order for the data to be interpreted as hex, you will need to specify the pseudo encoding of hex_string on the encoding parameter.
Examples
This is an example that results in the attachment being created with content 1234.
confluence --action addAttachment --space zcliattachment --title @home --name "hexString" --encoding hex_string --content "31323334"
This is an example that shows how Postgres escape format data can be handled. The resulting content is 1234.
confluence --action addAttachment --space zcliattachment --title @home --name "hexString" --encoding hex_string --content "\x 31 32 33 34"
Hex data can also come from a file or standard input.
confluence --action addAttachment --space zcliattachment --title @home --name "hexFile" --encoding HEX_STRING --file "-"