Vaelor / python-mattermost-driver

Python Mattermost Driver for APIv4
https://vaelor.github.io/python-mattermost-driver/
MIT License
187 stars 69 forks source link

Doesn't work image preview for several channels #135

Open khmelevskiy opened 2 weeks ago

khmelevskiy commented 2 weeks ago

It seems to me that the problem appeared after one of the last updates.

Mattermost Version: 9.9.0
Database Schema Version: 121
Build Number: 9307585135
Database: postgres

mattermostdriver==7.3.2
python version: 3.12.3
import mattermostdriver

if __name__ == "__main__":
    channel_id = "<channel_id>"
    file = "cat.png" # any img
    config = {
        "url": "<url>",
        "port": 443,
        "token": "<bot token>",
        "scheme": "https",
        "verify": True,
    }
    driver = mattermostdriver.Driver(options=config)
    driver.login()

    file_id = driver.files.upload_file(channel_id=channel_id, files={"files": (file, open(file, "rb"))})["file_infos"][
        0
    ]["id"]

    for i in range(3):
        driver.posts.create_post(options={"channel_id": channel_id, "message": f"test{i}", "file_ids": [file_id]})

As a result, we only have one image (the first one). The same error if we send the image through different channels:

image
khmelevskiy commented 1 week ago

https://github.com/mattermost/mattermost/issues/27526#issuecomment-2210986991