Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -129,12 +129,12 @@ |
130 | 130 | $thumb = $f->getThumbnail($this->urlwidth, $this->urlheight); |
131 | 131 | if($thumb) |
132 | 132 | { |
133 | | - $vals['thumburl'] = $thumb->getURL(); |
| 133 | + $vals['thumburl'] = Http::makeFullUrl( $thumb->getURL() ); |
134 | 134 | $vals['thumbwidth'] = $thumb->getWidth(); |
135 | 135 | $vals['thumbheight'] = $thumb->getHeight(); |
136 | 136 | } |
137 | 137 | } |
138 | | - $vals['url'] = $f->getURL(); |
| 138 | + $vals['url'] = Http::makeFullUrl( $f->getURL() ); |
139 | 139 | } |
140 | 140 | if($this->fld_comment) |
141 | 141 | $vals['comment'] = $f->getDescription(); |
Index: trunk/phase3/includes/SpecialFilepath.php |
— | — | @@ -13,7 +13,8 @@ |
14 | 14 | } else { |
15 | 15 | $file = wfFindFile( $title ); |
16 | 16 | if ( $file && $file->exists() ) { |
17 | | - $wgOut->redirect( $file->getURL() ); |
| 17 | + // Force a real 30x so the real url is always exposed |
| 18 | + $wgOut->redirect( Http::makeFullURL( $file->getURL() ) ); |
18 | 19 | } else { |
19 | 20 | $wgOut->setStatusCode( 404 ); |
20 | 21 | $cform = new FilepathForm( $title ); |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -117,4 +117,20 @@ |
118 | 118 | } |
119 | 119 | return false; |
120 | 120 | } |
| 121 | + |
| 122 | + /* |
| 123 | + * Return the full url of something relative to $wgScriptPath or root |
| 124 | + */ |
| 125 | + static function makeFullURL( $url ) { |
| 126 | + global $wgServer, $wgScriptPath; |
| 127 | + |
| 128 | + // This is a full url |
| 129 | + if ( strpos( $url, '://' ) !== false ) return $url; |
| 130 | + |
| 131 | + // This is a relative path |
| 132 | + if ( substr( $url, 0, 1 ) != '/' ) |
| 133 | + $url = $wgScriptPath.'/'.$url; |
| 134 | + |
| 135 | + return $wgServer.$url; |
| 136 | + } |
121 | 137 | } |