Skip to content

fix: fixed the image array to JSON error.#1087

Open
Sahil2004 wants to merge 4 commits into
mainfrom
fix/imageArrayToJSON
Open

fix: fixed the image array to JSON error.#1087
Sahil2004 wants to merge 4 commits into
mainfrom
fix/imageArrayToJSON

Conversation

@Sahil2004

@Sahil2004 Sahil2004 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description of change

Image array to JSON error fixed.

The migration doesn't update any table rather just fixes the previous image data urls and converts it into proper array so that the previous data remains intact and we do not have to flush the whole DB to fix the error.

Issue Number

Closes #1075

Type of change

  • Breaking (any change that would cause existing functionality to not work as expected)
  • Fix (a change which fixes an issue)
  • Chore (refactoring, build scripts or anything else that isn't user-facing)

How the change has been tested

Manually.

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when posts contain multiple images, including base64 image data with commas.
    • Updated image galleries and post modals to display provided image URLs directly, reducing incorrect image grouping and related warnings.
    • Existing post image data is automatically converted to the updated format during migration.
  • Chores

    • Added project-specific ignore guidance to prevent unintended files from being tracked.

@Sahil2004 Sahil2004 self-assigned this Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Sahil2004, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af1a4489-4e87-4a9b-bcdb-e011caf4deee

📥 Commits

Reviewing files that changed from the base of the PR and between 703e2bd and 210f87b.

📒 Files selected for processing (1)
  • platforms/pictique/api/src/database/migrations/1784133148233-ReencodePostImages.ts
📝 Walkthrough

Walkthrough

Post image storage changes from comma-delimited serialization to JSON, with migration support for existing rows. Pictique UI components now render provided image URI arrays directly, and the inlang project ignore rules were updated.

Changes

Post image encoding

Layer / File(s) Summary
Image persistence and migration
platforms/pictique/api/src/database/entities/Post.ts, platforms/pictique/api/src/database/migrations/...
The Post.images column uses simple-json; the migration converts legacy comma-joined values to JSON arrays and supports reversing the conversion.
Direct image URI rendering
platforms/pictique/client/src/lib/fragments/Post/Post.svelte, platforms/pictique/client/src/lib/fragments/PostModal/PostModal.svelte
Both components consume imgUris directly and remove chunk-pairing and derived URI logic.

Inlang project ignore rules

Layer / File(s) Summary
Inlang project ignore rules
infrastructure/control-panel/project.inlang/.gitignore
The ignore file now ignores all files except settings.json and includes explanatory guidance.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: coodos

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The inlang .gitignore change is unrelated to the image-serialization fix and appears outside the linked issue scope. Remove the unrelated .gitignore change or split it into a separate pull request with its own justification.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The entity, migration, and frontend cleanup address the corruption fix, legacy-row handling, and removal of the pair/join workaround.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title is concise and matches the main change: fixing the image array JSON serialization issue.
Description check ✅ Passed The description includes the required sections and is mostly complete, with issue, type, testing, and checklist filled in.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/imageArrayToJSON

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

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

@Sahil2004
Sahil2004 marked this pull request as ready for review July 16, 2026 16:10
@Sahil2004
Sahil2004 requested a review from coodos as a code owner July 16, 2026 16:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@platforms/pictique/api/src/database/migrations/1784133148233-ReencodePostImages.ts`:
- Around line 21-66: Update the up migration to process posts in bounded
keyset-paginated batches rather than loading all image rows at once; order and
fetch each batch using the post id, and continue until no rows remain. Replace
the per-row sequential updates inside each batch with a bulk update where
practical, while preserving the existing empty-string, valid-JSON, and legacy
comma-splitting conversion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aac31aac-8131-4fc2-a735-e692eea8eedc

📥 Commits

Reviewing files that changed from the base of the PR and between 91bf719 and 703e2bd.

📒 Files selected for processing (5)
  • infrastructure/control-panel/project.inlang/.gitignore
  • platforms/pictique/api/src/database/entities/Post.ts
  • platforms/pictique/api/src/database/migrations/1784133148233-ReencodePostImages.ts
  • platforms/pictique/client/src/lib/fragments/Post/Post.svelte
  • platforms/pictique/client/src/lib/fragments/PostModal/PostModal.svelte

@Sahil2004
Sahil2004 force-pushed the fix/imageArrayToJSON branch from 703e2bd to cfd7942 Compare July 16, 2026 16:23
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.

Image uploads corrupted on read due to simple-array comma-splitting base64 data URLs

1 participant