Skip to content

MC:3249 Confluence App :Resolved bug causing inserted diagrams to fai… #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Almoizs-1310
Copy link
Contributor

Resolved an issue where Mermaid diagrams were not rendering properly on Confluence pages due to oversized base64-encoded image data,which caused API failures. The plugin now compresses the base64 image before saving it via the Confluence API, significantly reducing payload size and improving rendering reliability

Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
confluence-mermaid-chart-plugin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2025 11:53am

@Almoizs-1310 Almoizs-1310 requested review from Prashant-7718, ashishjain0512 and knsv and removed request for Prashant-7718 June 23, 2025 12:58
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds client-side image compression and payload size checks to prevent oversized base64 images from failing the Confluence API during macro saves.

  • Introduces compressBase64Image and calculateDataSize utilities with configurable thresholds.
  • Integrates size checks in the form submission flow to conditionally compress images before saving.
  • Updates the macro save call to use compressed image data when payload exceeds limits.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
public/js/imageUtils.js Added base64 image compression and data size calculation utilities
public/js/editor/form.js Imported and applied compression logic with size threshold checks
Comments suppressed due to low confidence (2)

public/js/editor/form.js:104

  • [nitpick] This error handling only logs to the console and uses a less consistent message format. Consider showing a user-facing notification and standardizing the error text.
      console.error("The diagram is too large to save, Try simplifying your diagram or reducing its complexity");

public/js/imageUtils.js:1

  • There are no unit tests covering compressBase64Image or calculateDataSize. Adding tests would help ensure compression and size calculations work correctly and prevent regressions.
// Configuration for size limits and compression settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants