(bug 25277) Moved the space before the dirmark.
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Thu, 29 Mar 2012 19:17:06 +0000 (21:17 +0200)
committerAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Sat, 31 Mar 2012 13:37:43 +0000 (16:37 +0300)
If the dirmark is immediately adjacent to the file name, the user
may copy it with and then paste an unneeded dirmark somewhere.
It can be adjacent to the file description, however.

Patch set 2: using getDirMarkEntity, according to MaxSem's suggestion.

Change-Id: I9567a90e9a4b32cdf31af5f26044c8f80961f986

includes/ImagePage.php

index b41e126..7453baa 100644 (file)
@@ -279,7 +279,7 @@ class ImagePage extends Article {
                $max = $wgImageLimits[$sizeSel];
                $maxWidth = $max[0];
                $maxHeight = $max[1];
-               $dirmark = $wgLang->getDirMark();
+               $dirmark = $wgLang->getDirMarkEntity();
 
                if ( $this->displayImg->exists() ) {
                        # image
@@ -449,14 +449,21 @@ class ImagePage extends Article {
 
                                if ( !$this->displayImg->isSafeFile() ) {
                                        $warning = wfMsgNoTrans( 'mediawarning' );
+                                       // dirmark is needed here to separate the file name, which
+                                       // most likely ends in Latin characters, from the description,
+                                       // which may begin with the file type. In RTL environment
+                                       // this will get messy.
+                                       // The dirmark, however, must not be immediately adjacent
+                                       // to the filename, because it can get copied with it.
+                                       // See bug 25277.
                                        $wgOut->addWikiText( <<<EOT
-<div class="fullMedia"><span class="dangerousLink">{$medialink}</span>$dirmark <span class="fileInfo">$longDesc</span></div>
+<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
 <div class="mediaWarning">$warning</div>
 EOT
                                                );
                                } else {
                                        $wgOut->addWikiText( <<<EOT
-<div class="fullMedia">{$medialink}{$dirmark} <span class="fileInfo">$longDesc</span>
+<div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
 </div>
 EOT
                                        );