Skip to content

Conversation

@NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented Aug 31, 2025

Description

This PR adds certain docx types for appsmith to correctly identify them as Binary type.
Currently, appsmith detects these as Text type.

Fixes #41199

Media

Before
image

After
image

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/17358026403
Commit: 01d5f2e
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Sun, 31 Aug 2025 14:32:30 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Correctly handles Office OpenXML files (DOCX, XLSX, PPTX) returned by REST APIs as binary data.
    • Ensures these responses are base64-encoded and flagged as binary, enabling reliable file downloads and preventing garbled text.
    • Existing handling for JSON, images, PDFs, and other formats remains unchanged.
    • No changes required to existing queries; widgets and flows that consume binary responses will work as expected.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 31, 2025

Walkthrough

Added OpenXML MIME types (DOCX, XLSX, PPTX) to the binary data type set in RestAPIActivateUtils so responses with these content types are treated as binary (base64-encoded) with responseDataType set to BINARY.

Changes

Cohort / File(s) Summary
Binary MIME handling update
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/RestAPIActivateUtils.java
Extended BINARY_DATA_TYPES to include OpenXML MIME types for DOCX, XLSX, PPTX; existing types retained.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant RestAPIActivateUtils
  participant UpstreamAPI

  Client->>UpstreamAPI: Execute REST request
  UpstreamAPI-->>Client: HTTP response (Content-Type)
  Client->>RestAPIActivateUtils: Process response
  alt Content-Type in BINARY_DATA_TYPES (incl. OpenXML)
    note over RestAPIActivateUtils: Classify as BINARY
    RestAPIActivateUtils-->>Client: Base64-encoded body + responseDataType=BINARY
  else Other types
    note over RestAPIActivateUtils: Existing JSON/text/image handling
    RestAPIActivateUtils-->>Client: Processed accordingly
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Handle DOCX uploads via REST by treating OpenXML content types as binary (#41199)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation

Poem

New docs now sail in binary seas,
Base64 wraps them with gentle ease.
Sheets and slides join the flight,
OpenXML glimmers bright.
SharePoint nods—upload’s a breeze!

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/added-docx-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Bug Something isn't working Critical This issue needs immediate attention. Drop everything else Needs Triaging Needs attention from maintainers to triage Production labels Aug 31, 2025
@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label Aug 31, 2025
@NilanshBansal
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/17358029402.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41200.
recreate: .

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/RestAPIActivateUtils.java (1)

167-171: Make binary detection robust to Content-Type parameters.

Equality on contentType.toString() fails if servers append params (e.g., ; charset=utf-8). Compare type/subtype only.

-                        } else if (BINARY_DATA_TYPES.contains(contentType.toString())) {
+                        } else if (BINARY_DATA_TYPES.contains(contentType.getType() + "/" + contentType.getSubtype())) {

Follow-up (optional): model BINARY_DATA_TYPES as Set<MediaType> and use anyMatch(contentType::isCompatibleWith).

🧹 Nitpick comments (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/RestAPIActivateUtils.java (1)

60-69: Use generics for BINARY_DATA_TYPES to avoid raw type.

-    public static final Set BINARY_DATA_TYPES = Set.of(
+    public static final Set<String> BINARY_DATA_TYPES = Set.of(
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5faaff3 and 01d5f2e.

📒 Files selected for processing (1)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/RestAPIActivateUtils.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: server-spotless / spotless-check
  • GitHub Check: server-unit-tests / server-unit-tests
🔇 Additional comments (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/RestAPIActivateUtils.java (1)

65-68: OOXML MIME types correctly marked as binary — aligns with the issue’s goal.

Treating DOCX/XLSX/PPTX as binary should prevent misclassification and fixes the SharePoint upload flow for standard OpenXML responses.

@github-actions
Copy link

Deploy-Preview-URL: https://ce-41200.dp.appsmith.com

@NilanshBansal
Copy link
Contributor Author

Not merging the PR to keep the DP alive as it has been shared with the customer to try out the fix.

@NilanshBansal
Copy link
Contributor Author

Merging the PR as the user confirmed the fix is working on the DP

@NilanshBansal NilanshBansal merged commit 096fc8a into release Sep 3, 2025
51 checks passed
@NilanshBansal NilanshBansal deleted the fix/added-docx-types branch September 3, 2025 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Critical This issue needs immediate attention. Drop everything else Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [A-force] Issue with Docx generated file from carbone not uploading to SharePoint via REST API

3 participants