matterbridge icon indicating copy to clipboard operation
matterbridge copied to clipboard

Matterbridge unable to download attachments from Slack channel (after side organization added to channel)

Open TheDogWelder opened this issue 2 years ago • 2 comments

Describe the bug Matterbridge was able to get attachments from private slack channel before (and transfer it to Telegram) but, after side organization member was added to slack channel (by invite) MatterBridge unable to download attaches anymore

After side organization member was removed from channek - MatterBridge become able to get attaches again.

To Reproduce

  1. invite side organization member to private slack channel, where matterbridge bot attached is (wait till member joined)
  2. test attaches (put some picture in channel) - matterbridge unable to download it
  3. kick out side organization member from slack channel
  4. test attaches again (now matter bridge able to download again)

Expected behavior Matterbridge should be able to get attaches from private channel, where side organizations members joined in

Screenshots/debug logs

after side organization member joined in channel

time="2023-03-17T07:48:27Z" level=debug msg="== Receiving event &slack.MessageEvent{Msg:slack.Msg{ClientMsgID:"9467b527-949d-488c-a933-d3eb4b830218", Type:"message", Channel:"C04TENK836J", User:"U039HFZTCNN", Text:"", Timestamp:"1679039307.764709", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment{}, Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1679039307.764709", BotID:"", Username:"", Icons:(*slack.Icon)(nil), BotProfile:(*slack.BotProfile)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", LatestReply:"", Files:[]slack.File{slack.File{ID:"F04V4GZCL1W", Created:0, Timestamp:0, Name:"", Title:"", Mimetype:"", ImageExifRotation:0, Filetype:"pdf", PrettyType:"", User:"", Mode:"", Editable:false, IsExternal:false, ExternalType:"", Size:0, URL:"", URLDownload:"", URLPrivate:"", URLPrivateDownload:"", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"", PermalinkPublic:"", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}}, Upload:false, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"T02MW3XV4TU", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false, Metadata:slack.SlackMetadata{EventType:"", EventPayload:map[string]interface {}(nil)}, Blocks:slack.Blocks{BlockSet:[]slack.Block(nil)}, Permalink:""}, SubMessage:(*slack.Msg)(nil), PreviousMessage:(*slack.Msg)(nil)}" func=handleSlackClient file="bridge/slack/handlers.go:53" prefix=slack

time="2023-03-17T07:48:27Z" level=debug msg="Trying to download "" with size 0" func=HandleDownloadSize file="bridge/helper/helper.go:162" prefix=slack

time="2023-03-17T07:48:27Z" level=error msg="Could not download incoming file: &errors.errorString{s:"download  failed &url.Error{Op:\"Get\", URL:\"\", Err:(*errors.errorString)(0xc0007561d0)}"}" func=handleAttachments file="bridge/slack/handlers.go:325" prefix=slack

after side organization member removed from channel

time="2023-03-17T07:49:59Z" level=debug msg="== Receiving event &slack.MessageEvent{Msg:slack.Msg{ClientMsgID:"f256f33d-a05e-4ff6-bafb-4af1c58c2688", Type:"message", Channel:"C04TENK836J", User:"U039HFZTCNN", Text:"", Timestamp:"1679039399.705889", ThreadTimestamp:"", IsStarred:false, PinnedTo:[]string(nil), Attachments:[]slack.Attachment(nil), Edited:(*slack.Edited)(nil), LastRead:"", Subscribed:false, UnreadCount:0, SubType:"", Hidden:false, DeletedTimestamp:"", EventTimestamp:"1679039399.705889", BotID:"", Username:"", Icons:(*slack.Icon)(nil), BotProfile:(*slack.BotProfile)(nil), Inviter:"", Topic:"", Purpose:"", Name:"", OldName:"", Members:[]string(nil), ReplyCount:0, Replies:[]slack.Reply(nil), ParentUserId:"", LatestReply:"", Files:[]slack.File{slack.File{ID:"F04V4H5444Q", Created:1679039395, Timestamp:1679039395, Name:"JustTestPdf.pdf", Title:"JustTestPdf.pdf", Mimetype:"application/pdf", ImageExifRotation:0, Filetype:"pdf", PrettyType:"PDF", User:"U039HFZTCNN", Mode:"hosted", Editable:false, IsExternal:false, ExternalType:"", Size:32816, URL:"", URLDownload:"", URLPrivate:"https://files.slack.com/files-pri/T02MW3XV4TU-F04V4H5444Q/justtestpdf.pdf", URLPrivateDownload:"https://files.slack.com/files-pri/T02MW3XV4TU-F04V4H5444Q/download/justtestpdf.pdf", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"https://fastmt.slack.com/files/U039HFZTCNN/F04V4H5444Q/justtestpdf.pdf", PermalinkPublic:"https://slack-files.com/T02MW3XV4TU-F04V4H5444Q-9c42141ce4", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}}, Upload:false, Comment:(*slack.Comment)(nil), ItemType:"", ReplyTo:0, Team:"T02MW3XV4TU", Reactions:[]slack.ItemReaction(nil), ResponseType:"", ReplaceOriginal:false, DeleteOriginal:false, Metadata:slack.SlackMetadata{EventType:"", EventPayload:map[string]interface {}(nil)}, Blocks:slack.Blocks{BlockSet:[]slack.Block(nil)}, Permalink:""}, SubMessage:(*slack.Msg)(nil), PreviousMessage:(*slack.Msg)(nil)}" func=handleSlackClient file="bridge/slack/handlers.go:53" prefix=slack

time="2023-03-17T07:49:59Z" level=debug msg="Trying to download "JustTestPdf.pdf" with size 32816" func=HandleDownloadSize file="bridge/helper/helper.go:162" prefix=slack

time="2023-03-17T07:50:00Z" level=debug msg="Download OK "JustTestPdf.pdf" 32816" func=HandleDownloadData2 file="bridge/helper/helper.go:183" prefix=slack

time="2023-03-17T07:50:00Z" level=debug msg="== Receiving event &slack.FileSharedEvent{Type:"file_shared", EventTimestamp:"1679039399.004100", File:slack.File{ID:"F04V4H5444Q", Created:0, Timestamp:0, Name:"", Title:"", Mimetype:"", ImageExifRotation:0, Filetype:"", PrettyType:"", User:"", Mode:"", Editable:false, IsExternal:false, ExternalType:"", Size:0, URL:"", URLDownload:"", URLPrivate:"", URLPrivateDownload:"", OriginalH:0, OriginalW:0, Thumb64:"", Thumb80:"", Thumb160:"", Thumb360:"", Thumb360Gif:"", Thumb360W:0, Thumb360H:0, Thumb480:"", Thumb480W:0, Thumb480H:0, Thumb720:"", Thumb720W:0, Thumb720H:0, Thumb960:"", Thumb960W:0, Thumb960H:0, Thumb1024:"", Thumb1024W:0, Thumb1024H:0, Permalink:"", PermalinkPublic:"", EditLink:"", Preview:"", PreviewHighlight:"", Lines:0, LinesMore:0, IsPublic:false, PublicURLShared:false, Channels:[]string(nil), Groups:[]string(nil), IMs:[]string(nil), InitialComment:slack.Comment{ID:"", Created:0, Timestamp:0, User:"", Comment:""}, CommentsCount:0, NumStars:0, IsStarred:false, Shares:slack.Share{Public:map[string][]slack.ShareFileInfo(nil), Private:map[string][]slack.ShareFileInfo(nil)}}, FileID:"F04V4H5444Q"}" func=handleSlackClient file="bridge/slack/handlers.go:53" prefix=slack

Environment (please complete the following information):

  • OS: Ubuntu 20.04.3 LTS
  • Matterbridge version: 1.26.0 6dafebc7

Additional context

[general]
LogFile="/var/log/matterbridge/matterbridge.log"

[telegram]
[telegram.fastmt_bot]
	Token="***" 
	UseFullName=true
	RemoteNickFormat="<{NICK}> " # How your message will be formatted when bridged. 
	MessageFormat="HTMLNick :"
	QuoteFormat="{MESSAGE} (re @{QUOTENICK}: {QUOTEMESSAGE})"
	QuoteLengthLimit=46 # Truncuate long quotes to prevent spammy bridged messages
	IgnoreMessages="^/" # Don't bridge bot commands (as the responses will not be bridged)

[slack]
[slack.fastmt_bot]
	# slack application, named MatterBridge
	Token="***"
	RemoteNickFormat="{BRIDGE} - @{NICK}"
	# this will maps threads from other bridges on slack threads
	PreserveThreading=true

#################

[[gateway]]
	name="meros-cl"
	enable=true

[[gateway.inout]]
	account="telegram.fastmt_bot"
	channel="***"

[[gateway.inout]]
	account = "slack.fastmt_bot"
	channel = "***"

TheDogWelder avatar Mar 17 '23 08:03 TheDogWelder

Oh, and there are bot permissions on slack (as by slack bot setup manual)

bot channels:write chat.write:bot chat:write:user users.profile:read

TheDogWelder avatar Mar 17 '23 09:03 TheDogWelder