Mattermost Peer-to-Peer Forum

Websoket "posted" event not contains "file_ids"

#1

Summary

Hello everyone, Websoket “posted” event not contains “file_ids”
Mattermost 5.9

Steps to reproduce

headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);
headers.append(‘Authorization’, token`)

fetch(${apiUrl}/posts", {
method: ‘POST’,
headers,
body: JSON.stringify({
“channel_id”: channel_id,
“message”: “message”
“file_ids”: […some array of string]
})

Expected behavior

expected something like this (from demo.mattermost.com)
in posted.data.post:
post: “{
“id”:“4oxzetjye7bp9xpafe89uuydsa”,
“create_at”:1555514416955,
“update_at”:1555514416955,
“edit_at”:0,
“delete_at”:0,
“is_pinned”:false,
“user_id”:“er4tfd5877y9u8pxdpput5b9qy”,
“channel_id”:“9eyxmiurx78kirkaz7epg64coc”,
“root_id”:”"
,“parent_id”:"",
“original_id”:"",
“message”:"",
“type”:"",
“props”:{},
“hashtags”:"",
"file_ids[“t8d9wwcs3tdp3gmt7qz3zia8dc”],
“pending_post_id”:“er4tfd5877y9u8pxdpput5b9qy:1555514416850”}"

Observed behavior

but get
post: “{
“id”:“eqp7wne44ibdxkf41s85t4hknc”,
“create_at”:1555514666584,
“update_at”:1555514666593,
“edit_at”:0,
“delete_at”:0,
“is_pinned”:false,
“user_id”:“repsxkurspb19fubnf4osu9uyr”,
“channel_id”:“6odgcqrpybgtf8x8y1gk59pt7h”,
“root_id”:”",
“parent_id”:"",
“original_id”:"",
“message”:"",
“type”:"",
“props”:{},
“hashtags”:"",
“pending_post_id”:"",
“metadata”:{}
}"

NO FILE_IDS!

Same in fetch response, no file_ids:
channel_id: “6odgcqrpybg7879y1gk59pt7h”
create_at: 1555514666584
delete_at: 0
edit_at: 0
hashtags: “”
id: “eqp7wne44890xkf41s85t4hknc”
is_pinned: false
message: “”
metadata: {}
original_id: “”
parent_id: “”
pending_post_id: “”
props: {}
root_id: “”
type: “”
update_at: 1555514666593
user_id: “repsxkurs7899fubnf4osu9uyr”

#2

Hi @Sveta,

Do you see issues with uploading files in channels?

#3

No, everything is loaded into the database.

This request works fine and returns the expected file_ids:
“curl -F ‘files=@PATH/TO/LOCAL/FILE’ \\n-F ‘channel_id=CHANNEL_ID’ \\n–header ‘authorization: Bearer c49adc55z3f53ck7xtp8ebq1ir’\nhttps://your-mattermost-url.com/api/v4/files”

1 Like
#4

I want to clarify that the files are uploaded to the database, but I cannot attach them to the post. Since post creates without file_ids information. And the file information is missing in websocket “posted” event.

#5

Hi @Sveta, do you see this issue only on demo.mattermost.com?

#6

I see this error only on my local example. On demo.mattermost.com everything is working, but there is another version - 5.7.0 (
I have 5.9), maybe this is the case.

#7

Hi @Sveta,

Would you be open to doing a quick test at https://community.mattermost.com to see if our community server behaves as you expect? It’s currently on v5.10 version.

#8

v5.10 working OK

#9