News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Bug when editing a message with SMF 2.0 and SMF 2.1 inline attachment BBCodes

Started by GL700Wing, June 01, 2022, 01:56:18 AM

Previous topic - Next topic

GL700Wing

I've been testing what happens if I edit a message that has both inline tags inserted by the Post and PM Inline Attachments mod (eg, in a forum that was migrated from SMF 2.0) and inline tags inserted by SMF 2.1 and I've come across an issue with 'Modify Message' that corrupts the BBCodes in the message (this issue does not occur when using 'Quick Edit').

Scenario using only SMF 2.1 (ie, the Post and PM Inline Attachments mod is not installed):
1.  Edit an existing message that has one or more attachments with one or more Post and PM Inline Attachments ILA tags.
Sample ILA tags:
[attach id=1 msg=14]  [attach id=2 msg=14]
[attach id=3 msg=14]  [attach id=4 msg=14]
2.  Add some more attachments and insert them inline at the end of the message (or just use the 'Insert' button for the existing attachments to insert them at the end of the message).
3.  Save the message.
4.  Edit the message using 'Quick Edit', add a couple of line breaks, save the message (all the BBCodes are correct and the message displays correctly).
5.  Edit the message using 'Modify Message' and notice how the BBCodes are now corrupted - save the message and notice how the message now displays with corrupted BBCodes, errors about invalid attachment IDs and attachments that are no longer inserted inline.


Screen captures:
1.  The message with some Post and PM Inline Attachments ILA tags and some SMF 2.1 inline attachment tags:
You cannot view this attachment.

2.  The body of the message when edited using 'Quick Edit':
You cannot view this attachment.

3.  The body of the message as stored in the database before being edited with 'Modify Message':
You cannot view this attachment.

4.  The body of the message when being edited for the first time using 'Modify Message':
Note the following:
a.  The line break between the second and third original ILA tags has been deleted;
b.  The 'msg=NN' reference has been removed from each of the original ILA tags;
c.  The original ILA tags have had [/attach][ appended to them;
d.  All original ILA tags have been duplicated on a single line immediately before where the SMF 2.1 inline tags start (although the last of the original ILA tags is missing a closing [/attach][ tag); and
e.  An extra [/attach][ tag has been appended after the last of the SMF 2.1 inline tags.
You cannot view this attachment.

5.  The message saved after using 'Modify Message':
Note the error messages about invalid attachments, the extra nobbc][/attach][[/nobbc] tag, and the attachment that is no longer displayed inline.
You cannot view this attachment.

6.  The body of the message as stored in the database after being edited with 'Modify Message':
Note that the second original ILA tag is missing (ie, it was shown as [attach id=2][/attach] by 'Modify Message').
You cannot view this attachment.

7.  The body of the message when being edited a second time using 'Modify Message':
Note that this matches what is now stored in the database.
You cannot view this attachment.


Definitely bizarre!!


Note: This issue only occurs when editing a message that has a mix of inline tags inserted by the Post and PM Inline Attachments mod and inline tags inserted by SMF 2.1. 

That said, all my SMF 2.0 forums use the Post and PM Inline Attachments mod and as many posts that have attachments inserted inline are technical and may be periodically updated with new/updated images I don't want to migrate to SMF 2.1 at this stage and risk ending up with corrupted posts ...


Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Further to my first message the corruption of the SMF 2.0 and SMF 2.1 inline attachment BBCodes in one message also occurs when the SMF 2.0 inline attachment BBCodes are enclosed in '[nobbc]' tags.

Example code:
[nobbc]
[attach id=1 msg=14]  [attach id=2 msg=14]
[attach id=3 msg=14]  [attach id=4 msg=14]
[/nobbc]

[hr]
[attach id=46]Landscape_1.jpg[/attach]  [attach id=48]Landscape_2.jpg[/attach]
[attach id=50]Landscape_3.jpg[/attach]  [attach id=52]Landscape_4.jpg[/attach]
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

gevv

I've had this problem while sending a new message, topic several times   invalid attachment IDs   

I uploaded the pictures again
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

live627

How adept are you at hacking the JS? This seems to be a nice little conflict between your tag format and SMF's as defined in jquery.sceditor.smf.js.

GL700Wing

Quote from: live627 on June 03, 2022, 02:48:21 AMHow adept are you at hacking the JS?
Not my skill set unfortunately ...

QuoteThis seems to be a nice little conflict between your tag format and SMF's as defined in jquery.sceditor.smf.js.
I'd already worked out this is a JS issue but because I can't work out a JS solution (see above) I've been working on a Post and PM Inline Attachments mod1 solution that would automatically convert the tags created by this mod to SMF 2.1 format inline attachment tags when a message is displayed by someone who can edit the message2 ...



1. Which has been around since January 2010
2. This would result in consistent inline attachment tags in messages
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

-Rock Lee-

@GL700Wing You still can't find the solution right? The same thing happens to me I have to migrate an smf from 2.0 to 2.1 but all the attachments break, I tried several things but with so many messages it is not viable. I already fixed most of the failures, I only need this from the attachments... I ran out of ideas :'(.



Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

GL700Wing

Quote from: -Rock Lee- on July 24, 2022, 11:19:35 PM@GL700Wing You still can't find the solution right?
To address this issue I've been working on a new version of the ILA mod for SMF 2.1 that would automatically update the SMF 2.0 ILA tags in a message to standard SMF 2.1 tags (this would only happen when a message is viewed by a member who can also edit the message).  Unfortunately I became very ill with the flu in mid June and it took me six weeks to fully recover so I only started work again on this update last week ...

QuoteThe same thing happens to me I have to migrate an smf from 2.0 to 2.1 but all the attachments break, I tried several things but with so many messages it is not viable. I already fixed most of the failures, I only need this from the attachments... I ran out of ideas :'(.
If you install the ILA mod for SMF 2.1 the existing attachments should display correctly - as far as I know the issue I reported in this topic only occurs if you edit an existing message that contains both inline tags created by the ILA mod and SMF 2.1 using "Modify Message"  ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

-Rock Lee-

Quote from: GL700Wing on July 25, 2022, 01:23:34 AMTo address this issue I've been working on a new version of the ILA mod for SMF 2.1 that would automatically update the SMF 2.0 ILA tags in a message to standard SMF 2.1 tags (this would only happen when a message is viewed by a member who can also edit the message).  Unfortunately I became very ill with the flu in mid June and it took me six weeks to fully recover so I only started work again on this update last week ...

Oh it's good to read that you'll recover from that flu! No problem there!

Quote from: GL700Wing on July 25, 2022, 01:23:34 AMIf you install the ILA mod for SMF 2.1 the existing attachments should display correctly - as far as I know the issue I reported in this topic only occurs if you edit an existing message that contains both inline tags created by the ILA mod and SMF 2.1 using "Modify Message"  ...

I'm going to check again and reconvert because it marks me 404 but the attachment is there, when converting I didn't get any errors either. Layers I am missing some file. As you say it should work fine!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

GL700Wing

Quote from: -Rock Lee- on July 25, 2022, 08:35:16 PMI'm going to check again and reconvert because it marks me 404 but the attachment is there, when converting I didn't get any errors either. Layers I am missing some file. As you say it should work fine!
@-Rock Lee- - There may have been an attachments issue during the conversion - the following topic provides some information and a script to fix the issue: Attachments lost since SMF 2.0 to SMF 2.1.2 upgrade
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

-Rock Lee-

Quote from: GL700Wing on July 25, 2022, 09:08:14 PM@-Rock Lee- - There may have been an attachments issue during the conversion - the following topic provides some information and a script to fix the issue: Attachments lost since SMF 2.0 to SMF 2.1.2 upgrade


Thanks, I'm going to look at it... in the meantime I went back to download a backup copy to try again in case I missed files. Because they are all .dat so it made me think I was missing files because even the avatars converted fine.
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Advertisement: