Bugfix for support attachment base64 and custom filename.

Introduce tests for attachment data parsing. Use tests at build stage.
This commit is contained in:
zeetabit
2022-07-31 13:45:29 +02:00
parent c52fa0e53c
commit 270278ca30
8 changed files with 169 additions and 43 deletions

View File

@@ -241,7 +241,9 @@ var doc = `{
}
],
"responses": {
"200": {},
"200": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -281,7 +283,9 @@ var doc = `{
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -323,7 +327,9 @@ var doc = `{
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -365,7 +371,9 @@ var doc = `{
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1200,7 +1208,9 @@ var doc = `{
}
],
"responses": {
"201": {},
"201": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1472,7 +1482,9 @@ var doc = `{
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1687,7 +1699,7 @@ var doc = `{
"properties": {
"base64_attachment": {
"type": "string",
"example": "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
"example": "'\u003cBASE64 ENCODED DATA\u003e' OR 'data:\u003cMIME-TYPE\u003e;base64,\u003cBASE64 ENCODED DATA\u003e' OR 'data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64,\u003cBASE64 ENCODED DATA\u003e'"
},
"is_group": {
"type": "boolean"
@@ -1712,9 +1724,13 @@ var doc = `{
"base64_attachments": {
"type": "array",
"items": {
"type": "string",
"example": "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
}
"type": "string"
},
"example": [
"\u003cBASE64 ENCODED DATA\u003e",
"data:\u003cMIME-TYPE\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e",
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
]
},
"message": {
"type": "string"

View File

@@ -225,7 +225,9 @@
}
],
"responses": {
"200": {},
"200": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -265,7 +267,9 @@
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -307,7 +311,9 @@
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -349,7 +355,9 @@
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1184,7 +1192,9 @@
}
],
"responses": {
"201": {},
"201": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1456,7 +1466,9 @@
}
],
"responses": {
"204": {},
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
@@ -1671,7 +1683,7 @@
"properties": {
"base64_attachment": {
"type": "string",
"example": "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
"example": "'\u003cBASE64 ENCODED DATA\u003e' OR 'data:\u003cMIME-TYPE\u003e;base64,\u003cBASE64 ENCODED DATA\u003e' OR 'data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64,\u003cBASE64 ENCODED DATA\u003e'"
},
"is_group": {
"type": "boolean"
@@ -1696,9 +1708,13 @@
"base64_attachments": {
"type": "array",
"items": {
"type": "string",
"example": "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
}
"type": "string"
},
"example": [
"\u003cBASE64 ENCODED DATA\u003e",
"data:\u003cMIME-TYPE\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e",
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
]
},
"message": {
"type": "string"

View File

@@ -106,8 +106,10 @@ definitions:
api.SendMessageV1:
properties:
base64_attachment:
example: '''<BASE64 ENCODED DATA>'' OR ''data:<MIME-TYPE>;base64,<BASE64 ENCODED
DATA>'' OR ''data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED
DATA>'''
type: string
example: "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
is_group:
type: boolean
message:
@@ -122,9 +124,12 @@ definitions:
api.SendMessageV2:
properties:
base64_attachments:
example:
- <BASE64 ENCODED DATA>
- data:<MIME-TYPE>;base64<comma><BASE64 ENCODED DATA>
- data:<MIME-TYPE>;filename=<FILENAME>;base64<comma><BASE64 ENCODED DATA>
items:
type: string
example: "<BASE64 ENCODED DATA> or 'data:<MIME-TYPE>;base64,<BASE64 ENCODED DATA>' or 'data:<MIME-TYPE>;filename=<FILENAME>;base64,<BASE64 ENCODED DATA>'"
type: array
message:
type: string
@@ -391,7 +396,8 @@ paths:
produces:
- application/json
responses:
"200": {}
"200":
description: ""
"400":
description: Bad Request
schema:
@@ -418,7 +424,8 @@ paths:
produces:
- application/json
responses:
"204": {}
"204":
description: ""
"400":
description: Bad Request
schema:
@@ -446,19 +453,22 @@ paths:
produces:
- application/json
responses:
"204": {}
"204":
description: ""
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added.
summary: Updates the info associated to a number on the contact list. If the
contact doesnt exist yet, it will be added.
tags:
- Contacts
/v1/devices/{number}:
post:
consumes:
- application/json
description: Links another device to this device. Only works, if this is the master device.
description: Links another device to this device. Only works, if this is the
master device.
parameters:
- description: Registered Phone Number
in: path
@@ -474,7 +484,8 @@ paths:
produces:
- application/json
responses:
"204": {}
"204":
description: ""
"400":
description: Bad Request
schema:
@@ -846,7 +857,8 @@ paths:
- Identities
/v1/identities/{number}/trust/{numberToTrust}:
put:
description: Trust an identity. When 'trust_all_known_keys' is set to' true', all known keys of this user are trusted. **This is only recommended for testing.**
description: Trust an identity. When 'trust_all_known_keys' is set to' true',
all known keys of this user are trusted. **This is only recommended for testing.**
parameters:
- description: Input Data
in: body
@@ -981,7 +993,9 @@ paths:
get:
consumes:
- application/json
description: Receives Signal Messages from the Signal Network. If you are running the docker container in normal/native mode, this is a GET endpoint. In json-rpc mode this is a websocket endpoint.
description: Receives Signal Messages from the Signal Network. If you are running
the docker container in normal/native mode, this is a GET endpoint. In json-rpc
mode this is a websocket endpoint.
parameters:
- description: Registered Phone Number
in: path
@@ -1027,7 +1041,8 @@ paths:
produces:
- application/json
responses:
"201": {}
"201":
description: ""
"400":
description: Bad Request
schema:
@@ -1074,7 +1089,8 @@ paths:
get:
consumes:
- application/json
description: Check if one or more phone numbers are registered with the Signal Service.
description: Check if one or more phone numbers are registered with the Signal
Service.
parameters:
- collectionFormat: multi
description: Numbers to check
@@ -1192,7 +1208,9 @@ paths:
post:
consumes:
- application/json
description: Disables push support for this device. **WARNING:** If *delete_account* is set to *true*, the account will be deleted from the Signal Server. This cannot be undone without loss.
description: Disables push support for this device. **WARNING:** If *delete_account*
is set to *true*, the account will be deleted from the Signal Server. This
cannot be undone without loss.
parameters:
- description: Registered Phone Number
in: path
@@ -1207,7 +1225,8 @@ paths:
produces:
- application/json
responses:
"204": {}
"204":
description: ""
"400":
description: Bad Request
schema: