Advertisement:

Author Topic: Bug on QuickModify: The message body was left empty.  (Read 1122 times)

Offline Kolya

  • Full Member
  • ***
  • Posts: 456
  • systemshock.org
Bug on QuickModify: The message body was left empty.
« 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, or just see the attached screenshot.

The issue is similar to one I posted about a while ago and so I was able to fix this:

In Themes\default\scripts\topic.js

FIND
Code: [Select]
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
Code: [Select]
x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value;
x[x.length] = 'message=' + document.forms.quickModForm['message'].value;

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

REPLACE
Code: [Select]
x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value;

Note that in SMF 2.1 a similar fix has already been implemented. The various escaping and replace functions have been removed there as well.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 59,409
  • Gender: Male
    • Kindred-999 on GitHub
Re: Bug on QuickModify: The message body was left empty.
« Reply #1 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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Kolya

  • Full Member
  • ***
  • Posts: 456
  • systemshock.org
Re: Bug on QuickModify: The message body was left empty.
« Reply #2 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.)