Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Kolya on March 28, 2020, 06:45:06 PM

Title: Bug on QuickModify: The message body was left empty.
Post by: Kolya on March 28, 2020, 06:45:06 PM
In SMF 2.0.17 there is a bug with posting special characters (eg: ä,ö,ü) and unicode emojis (😊) when in quick modify mode.
You can test this here on the board (https://www.simplemachines.org/community/index.php?board=7.0), or just see the attached screenshot.

The issue is similar to one I posted about a while ago (https://www.simplemachines.org/community/index.php?topic=553550.0) and so I was able to fix this:

In Themes\default\scripts\topic.js

FIND

x[x.length] = 'subject=' + escape(document.forms.quickModForm['subject'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");
x[x.length] = 'message=' + escape(document.forms.quickModForm['message'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B");


REPLACE

x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value;
x[x.length] = 'message=' + document.forms.quickModForm['message'].value;


FIND

x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value.replace(/&#/g, "&#").php_to8bit().php_urlencode();


REPLACE

x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value;


Note that in SMF 2.1 a similar fix has already been implemented (https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Themes/default/scripts/topic.js). The various escaping and replace functions have been removed there as well.
Title: Re: Bug on QuickModify: The message body was left empty.
Post by: Kindred on March 28, 2020, 07:21:19 PM
Thank you, tes. This is a known issue ( it was reported the day after 2.0.17 release.)

A fix will be in 2.0.18
Title: Re: Bug on QuickModify: The message body was left empty.
Post by: Kolya on April 05, 2020, 06:11:18 AM
I noticed that the fix I posted above truncates URLs at '&' characters when quick modifying posts. I therefore recommend NOT to use this fix.

Instead follow the instructions by SMF developer shawnb61 here: https://www.simplemachines.org/community/index.php?topic=571082.msg4042818#msg4042818

(Unfortunately I cannot edit my first post anymore, to point at shawnb61's post directly.)
Title: Re: Bug on QuickModify: The message body was left empty.
Post by: shawnb61 on February 01, 2021, 05:46:39 PM
Closing - This was addressed in 2.0.18.