]> git.mxchange.org Git - friendica.git/commitdiff
Tests added
authorMichael <heluecht@pirati.ca>
Tue, 21 Mar 2023 04:20:03 +0000 (04:20 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 21 Mar 2023 04:20:03 +0000 (04:20 +0000)
src/Content/Text/BBCode.php
tests/src/Content/Text/BBCodeTest.php

index 930b94ac465bae41b947cf4933df15d3e6c113d3..a38d2de7856ec39f7c24c38c36d7a5af6c92eee2 100644 (file)
@@ -1568,7 +1568,7 @@ class BBCode
                                        function ($matches) use ($simple_html, $uriid) {
                                                $matches[1] = self::proxyUrl($matches[1], $simple_html, $uriid);
                                                $alt = htmlspecialchars($matches[2], ENT_COMPAT);
-                                               // Fix for Markdown problems wirh Diaspora, see issue #12701
+                                               // Fix for Markdown problems with Diaspora, see issue #12701
                                                if (($simple_html != self::DIASPORA) || strpos($matches[2], '"') === false) {
                                                        return '<img src="' . $matches[1] . '" alt="' . $alt . '" title="' . $alt . '">';
                                                } else {
index 6f8fdea2e666106e3c285193212b38e288aea37f..74d34f5a5e836064cc001ac6a892a6eace2b48d7 100644 (file)
@@ -317,6 +317,14 @@ Karl Marx - Die ursprüngliche Akkumulation
                                'expected' => '&amp;`&`',
                                'text' => '&[code]&[/code]',
                        ],
+                       'bug-12701-quotes' => [
+                               'expected' => '[![abc"fgh](https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png)](https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581)',
+                               'text' => '[url=https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581][img=https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png]abc"fgh[/img][/url]'
+                       ],
+                       'bug-12701-no-quotes' => [
+                               'expected' => '[![abcfgh](https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png "abcfgh")](https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581)',
+                               'text' => '[url=https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581][img=https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png]abcfgh[/img][/url]'
+                       ],
                ];
        }
 
@@ -331,7 +339,7 @@ Karl Marx - Die ursprüngliche Akkumulation
         *
         * @throws InternalServerErrorException
         */
-       public function testToMarkdown(string $expected, string $text, $for_diaspora = false)
+       public function testToMarkdown(string $expected, string $text, $for_diaspora = true)
        {
                $actual = BBCode::toMarkdown($text, $for_diaspora);