Bowrna commented on issue #42889:
URL: https://github.com/apache/airflow/issues/42889#issuecomment-2416055541

   @hzlmn On debugging further with the data you shared above, could you tell 
me what method_version you are using to upload files using SlackOperator? The 
default one is "v2", while you can still pass the old version "v1". 
   
   
https://github.com/apache/airflow/blob/e20146d44b340f719f7fb432f93741e011690558/providers/src/airflow/providers/slack/operators/slack.py#L232-L234
   
   Here the execute method to invoke the Slack API chooses the upload based on 
the method version.
   
   
https://github.com/apache/airflow/blob/e20146d44b340f719f7fb432f93741e011690558/providers/src/airflow/providers/slack/operators/slack.py#L257-L271
   
   The send_file method call of v1 function invokes API call where we send the 
filetype. The above issue fix that you have recommended applies here.
   
   Then there is another version v2 which is the updated version, where we 
upload file with different SDK method call. We pass a dict of file_uploads. ( 
in this dict we can pass file(or content) (here file represents the filepath, 
content represents the actual filecontent), filename, title, snippet_type, 
alt_txt)
   
   
https://github.com/apache/airflow/blob/e20146d44b340f719f7fb432f93741e011690558/providers/src/airflow/providers/slack/hooks/slack.py#L289-L322
   
   In the above method we are passing the filetype into snippet_type. But 
snippet_type is an optional argument for syntax highlighting in case code 
content is uploaded. ( It can support types like python, HTML etc. Passing the 
filetype into snippet_type seems to be incorrect). In V2 version, there is no 
explicit way to pass the filetype, as I think with file upload directly as 
multipart binary, the metadata or MIME of the file content can be used to find 
the file type.
   
   @potiuk Can you tell me if I can raise a fix where we can get another param 
for snippet_type, rather than passing the filetype into it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to