[BUG] Editing a blog comment only captures the first paragraph of the comment

  • Hello.

    I recently noticed a little bug with the blogs - I don't know if it affects the user blogs (I don't use those), but it does affect the Desktop Snapshots blog for example.

    Here goes: clicking 'Edit' on a comment that spans more than one paragraph discards everything after the first paragraph. To illustrate this, say you post the following (Lorem ipsum text for illustrative purposes):

    Do ea ut occaecat deserunt.
    Id laboris magna est.

    clicking 'Edit' would only insert the following into the text field:

    Do ea ut occaecat deserunt.

    Since this seems to be a front-end issue, I took the liberty to try to fix it and I think I managed to do so.

    Basically, in vivaldi-comments.js, replacing this

    formInput.innerHTML = postBody.getElementsByTagName('p')[0].innerHTML.replace(/<[^>]+>/gm, '');

    with something like this:

    var postParagraphs = Array.from(postBody.getElementsByTagName('p'));
    formInput.innerHTML = postParagraphs.map(p => p.innerHTML.replace(/<[^>]+>/gm, '')).join('\n\n');

    seems to work. No security implications whatsoever (that I can see), so I hope it's not a problem that I post this publicly.

  • @killchain Well spotted 👍

    I think most users comment directly on the forum posts, not on the blog itself, so it's not been noticed.

  • Moderator

    @killchain Thanks for the finding.
    Please be so kind and report the issue. Open Vivaldi bug tracker by menu Help > Report a bug, select for "Affected product *" the "vivaldi.net services ..." and send them a message (give them the information you posted here).

  • @Gwen-Dragon Submitted, issue reference 24413698773.

  • Vivaldi Team

    I moved the ticket to a different project, so now the ticket number to follow is VIV-978.

Log in to reply

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.