slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://slack.dev/java-slack-sdk/
MIT License
571 stars 213 forks source link

Uploaded .xlsx File Recognized as a Binary File When Using Apache POI 4.1.2 with Slack Java SDK #1353

Open diiiiiiiino opened 2 weeks ago

diiiiiiiino commented 2 weeks ago

Hello,
I am using the Slack Java SDK to send file links via Slack channel messages, but the uploaded .xlsx file is being recognized as a binary file, as shown in the image below.
The file is generated in Java using Apache POI version 4.1.2. When generated with version 3.17, it is recognized as an Excel file. Could you help me understand what the issue might be that is causing the file to not be recognized properly?

The Slack SDK version

com.slack.api:slack-api-client:1.42.0

Java Runtime version

java 21

OS info

ProductName: macOS ProductVersion: 13.2.1

Expected result:

스크린샷 2024-08-30 오후 2 39 17

Actual result:

seratch commented 2 weeks ago

Hi @diiiiiiiino, thanks for asking the question.

We are unable to help you with Apache POI specific questions, but perhaps its new major version might generate different file metadata, which may not be recognized by Slack's auto file type detection.

As a workaround, explicitly passing the file type may help rather than relying on Slack's auto-detection. Please refer to https://github.com/slackapi/java-slack-sdk/issues/995 for details.

diiiiiiiino commented 2 weeks ago

Thank you for your response I apologize, but I have one more question.

I have already checked the link you provided!
I confirmed that the file upload method used in the link is from version 1, where specifying the file type is possible.
However, I am using the version 2 file upload method.

I'm using the method FilesUploadV2Response filesUploadV2Response = this.methodsClient.filesUploadV2(request);. How can I specify a particular file type?

seratch commented 2 weeks ago

Sorry, it seems that the parameter is no longer supported in the new way to upload files. Please try to set complete metadata to your generated Excel files (like the ones human manually crafts).