Send the osTicket ticket text as base64, not percent-encoded
A test ticket sent to a real osTicket arrived with every space shown as %20. osTicket takes the message's type from an RFC 2397 data URL and strips the "data:" part, but leaves percent-encoded text as it is. The message is now sent as base64 (data:text/plain;charset=utf-8;base64,...), which osTicket decodes (it is how it takes attachments), and which works whether or not a given osTicket version decodes percent-encoding. The stand-in osTicket in the test had decoded the percent-encoding, which is why this wasn't caught: the test now requires base64 and fails if any percent-encoding is in the message. INTEGRATIONS.md says the ticket API is only partly verified against a real osTicket, and what that first test showed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aec553f122
commit
5072cee519
3 files changed
+14
-9
No files matched your search
@@ -106,8 +106,9 @@ export function createOsTicketTicketApi(config: OsTicketApiConfig) {
|
||||
name: ticket.name,
|
||||
email: ticket.email,
|
||||
subject: ticket.subject,
|
||||
// osTicket reads the type of the message from an RFC 2397 data URL.
|
||||
message: `data:text/plain;charset=utf-8,${encodeURIComponent(ticket.message)}`,
|
||||
// osTicket reads the type of the message from an RFC 2397 data URL. Base64, not percent-encoding: osTicket strips the
|
||||
// "data:" part but leaves percent-encoded text as it is (a test ticket arrived full of %20), while base64 is decoded.
|
||||
message: `data:text/plain;charset=utf-8;base64,${Buffer.from(ticket.message, "utf8").toString("base64")}`,
|
||||
...(ticket.topicId ? { topicId: ticket.topicId } : {}),
|
||||
...(ticket.priorityId ? { priority: ticket.priorityId } : {}),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user