Skip to content
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

Quotes / double escaping issue #4

Open
abr-storm opened this issue Sep 17, 2024 · 3 comments · May be fixed by #5
Open

Quotes / double escaping issue #4

abr-storm opened this issue Sep 17, 2024 · 3 comments · May be fixed by #5

Comments

@abr-storm
Copy link

Ruby: 3.4 preview
Rails: Edge
Postgresql: 17rc1

I'm running into an issue when my payload becomes large enough to trigger the special handling of this adapter. I'm rendering responses on the server side like this:

def broadcast
  html = ApplicationController.render(partial: "my/partial", layout: false)
  broadcast_action_later_to self, action: "replace", target: dom_id(self), html:
end

The page is updated with the correct markup when using the async adapter, or the enhanced_postgresql adapter when the response is small enough:

<div>
  <h1 class="font-bold text-xxl">Placeholder heading</h1>
</div>

But when the payload is large enough to trigger a read from action_cable_large_payloads, the markup looks like this:

<div>
  <h1 class="" font-bold="" text-xxl''="">Placeholder heading</h1>
</div>
@martinmanyhats
Copy link

Ruby: 3.3.1
Rails: 7.2.0
Postgresql: 14.13

Well that might explain why I've seen very similar symptoms ie attributes being mangled the same way. I ended up breaking the element to be replaced (which could get large) in to a number of much smaller fragments that are individually updated via a sequence of broadcast_replace_to. So I guess I managed to reduce each fragment to be under the magic size limit.

@chriscz
Copy link

chriscz commented Sep 18, 2024

There are a few unescaped incorrectly escaped exec calls in the source. In particular where the payload was inserted into the DB.

@chriscz chriscz linked a pull request Sep 18, 2024 that will close this issue
@martinmanyhats
Copy link

I've manually added the fix by chriscz and it resolved my issue with quotes being messed up for a larger payload.

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 a pull request may close this issue.

3 participants