Skip to content

Fix/cpim handling from dryrun 1#99

Merged
dunkeltron merged 3 commits into
devfrom
fix/cpim-handling-from-dryrun-1
May 5, 2026
Merged

Fix/cpim handling from dryrun 1#99
dunkeltron merged 3 commits into
devfrom
fix/cpim-handling-from-dryrun-1

Conversation

@LawOfSynergy
Copy link
Copy Markdown

@LawOfSynergy LawOfSynergy commented May 2, 2026

Prior pull request was incomplete, as it was missing the corresponding lua encoding step. Both need to be updated simultaneously to be consistent with each other.

lua/index.lua's uriescape was mixed-style: it correctly escaped literal `+`
to `%2B` (RFC 3986), but encoded whitespace as `+` (form-urlencoded). This
created ambiguity since mod_curl decodes `%XX` but leaves `+` literal —
both space-as-`+` and `+`-from-`%2B` arrived at PHP indistinguishable.

outbound-hook.php's urldecode (form-urlencoded) then mangled all `+` to
space, corrupting DB-stored Content-Type fields like
`application/vnd.gsma.rcs-ft-http+xml` to `... xml` (literal space).

Fix is coupled across both files:
- lua/index.lua line 12: spaces → %20 (RFC 3986) instead of `+`
- outbound-hook.php lines 32, 33, 40: rawurldecode (RFC 3986) instead of urldecode

Both must change together — see comments in each file. Web UI branch is
unaffected (frontend sends raw JSON, so rawurldecode is a no-op there
and incidentally fixes a latent `+`-mangle bug for user-typed messages).
@LawOfSynergy
Copy link
Copy Markdown
Author

f3f4366 formalizes the code change that I am manually patching into webtexting.umd.js when deploying messaging to prod. The patching of that file is why I added a mechanism to invalidate caching of the old file by clients (I experienced this issue myself in firefox while testing) in cc40110.

2c17511 is a self contained fix necessary for text to be displayed properly (spaces instead of +) AND for mime types to be correctly stored in the database (+ instead of spaces). It was effectively mutually exclusive before the change.

@LawOfSynergy
Copy link
Copy Markdown
Author

LawOfSynergy commented May 2, 2026

I am also not sure how the deploy pipeline for the js stuff works, so as long as the f3f4366 change ends up being wrapped up in whatever bundle replaces the patched version on the prod servers, everything is good.

Note: none of this is in prod quite yet, as I have been doing testing and dry-runs of the runbook. I am probably going to aim for tuesday night for the actual deployment.

@dunkeltron
Copy link
Copy Markdown
Contributor

I never got to understanding the git action around building the front end. I deploy by scp'ing the build files from my dev environment to prod

@dunkeltron dunkeltron merged commit 8d17f2a into dev May 5, 2026
1 check passed
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