Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] How to use images in api properly? #2052

Open
yousefmansy1 opened this issue May 20, 2023 · 1 comment
Open

[api] How to use images in api properly? #2052

yousefmansy1 opened this issue May 20, 2023 · 1 comment
Labels

Comments

@yousefmansy1
Copy link
Contributor

Describe the bug
Using this site to convert to base 64, I run a sample post with image data and on discord no file is sent at all, and on telegram only a malformed file is sent. (downloading it and changing the extension makes it work as an image again, so the data is fine.)

Original PR, does not have any example. #1993

To Reproduce

DATA=$(cat << EOF
{
	"username": "test",
	"text": "test",
	"gateway": "test",
	"event": "",
	Extra" : {
		"file": [
			{
				"Data": ["BASE64DATA"]
			}
		]
	}
}
EOF

)

curl -XPOST -H 'Content-Type: application/json'  -d "$DATA" http://localhost:4242/api/message#

Expected behavior
Image should show, but it does not.

Screenshots/debug logs
image
image

Environment (please complete the following information):

  • linux/docker

Additional context

[api]
	[api.myapi]
		BindAddress="172.22.0.111:4242"
		Buffer=1000
		
		
....

[[gateway]]
name="test"
enable=true
	[[gateway.in]]
	account="api.myapi"
	channel="api"
@tehsu
Copy link

tehsu commented Jul 21, 2024

Do it like this instead,

         ```

'Extra':{
'file': [
{'Data': file,
'Name': 'filename.jpeg',
'Comment': message
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants