Skip to content

Fix editor image routing#12683

Merged
alecslupu merged 18 commits intodecidim:developfrom
mainio:fix/editor-image-routing
Nov 5, 2024
Merged

Fix editor image routing#12683
alecslupu merged 18 commits intodecidim:developfrom
mainio:fix/editor-image-routing

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

🎩 What? Why?

While implementing #12576, there was one problem regarding the blob URLs that are persisted to the database which is that they cannot be created dynamically at render time because the HTML is persisted to the database as-is.

This fixes the issue by replacing references to any blob URLs with the blob's global ID and then swapping it back to the actual URL when these values are rendered.

This fixes two issues:

  1. The blob URLs can be represented in more performant way referencing the direct storage URLs as described at Improve ActiveStorage asset linking performance #12576
  2. The blob URLs should not expire if they are stored to the database in a timely manner (i.e. within 7 days from creation)

This also changes the signed blob URL expiry period to 7 days which is the maximum set by Amazon S3 and Google Cloud Files. This has to be used together with a sensible caching strategy as the expiry periods of these 3rd party services cannot be extended. In other words, when using Amazon S3 or Google Cloud Files, the cache has to be cleared at least once every 7 days because e.g. the content block cache is set to expire never.

📌 Related Issues

Link your PR to an issue

Testing

  • Edit some content that has rich text editor, e.g. a static page
  • Embed an image to the content
  • Save the form
  • See the rich text content value in the database, you should now see the image src attribute replaced with gid://decidim-development-app/ActiveStorage::Blob/XYZ (where XYZ is the blob ID in the database)
  • Go to see the page at the participant-facing view
  • See that the image is rendered correctly

Anything that uses the SettingsManifest can also have rich text
content where the blob replacement logic has to be applied at.
github-actions[bot]
github-actions bot previously approved these changes Apr 10, 2024
github-actions[bot]
github-actions bot previously approved these changes Apr 10, 2024
@andreslucena andreslucena self-assigned this Jul 1, 2024
github-actions[bot]
github-actions bot previously approved these changes Jul 22, 2024
github-actions[bot]
github-actions bot previously approved these changes Jul 22, 2024
github-actions[bot]
github-actions bot previously approved these changes Jul 23, 2024
@ahukkanen ahukkanen marked this pull request as ready for review July 23, 2024 14:16
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

👍

@alecslupu alecslupu added this to the 0.30.0 milestone Nov 5, 2024
@alecslupu alecslupu merged commit 32f9cc6 into decidim:develop Nov 5, 2024
@alecslupu alecslupu added the release: v0.29 Issues or PRs that need to be tackled for v0.29 label Nov 5, 2024
@alecslupu alecslupu added the release: v0.28 Issues or PRs that need to be tackled for v0.28 label Nov 5, 2024
entantoencuanto added a commit that referenced this pull request Nov 6, 2024
…n-flow

* develop:
  Update UI design of detail page (#13356)
  Fix newsletter subscriber count (#13471)
  Fix editor image routing (#12683)
  Fix issues with the budgets proposals import (#12655)
  Fix initiative form is not taking into account the scope selected (#13598)
  Enable geolocation for address field in proposal form (#13423)
entantoencuanto added a commit that referenced this pull request Nov 6, 2024
…eature/ephemeral-verifications

* feat/improve-registration-and-verification-flow:
  Update UI design of detail page (#13356)
  Fix newsletter subscriber count (#13471)
  Fix editor image routing (#12683)
  Fix issues with the budgets proposals import (#12655)
  Fix initiative form is not taking into account the scope selected (#13598)
  Enable geolocation for address field in proposal form (#13423)
entantoencuanto added a commit that referenced this pull request Nov 6, 2024
…taging-lot2

* feat/improve-registration-and-verification-flow:
  Update UI design of detail page (#13356)
  Fix newsletter subscriber count (#13471)
  Fix editor image routing (#12683)
  Fix issues with the budgets proposals import (#12655)
  Fix initiative form is not taking into account the scope selected (#13598)
@ahukkanen ahukkanen deleted the fix/editor-image-routing branch March 11, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Expiration time in URL attachments

3 participants