Index: trunk/tools/upload-scripts/thumb-handler.php |
— | — | @@ -1,6 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -$uri = $_SERVER['REQUEST_URI']; |
| 4 | +# lighttpd puts the original request in REQUEST_URI, while |
| 5 | +# sjs sets that to the 404 handler, and puts the original |
| 6 | +# request in REDIRECT_URL. |
| 7 | +if (isset($_SERVER['REDIRECT_URL'])) { |
| 8 | + $uri = $_SERVER['REDIRECT_URL']; |
| 9 | +} else { |
| 10 | + $uri = $_SERVER['REQUEST_URI']; |
| 11 | +} |
5 | 12 | |
6 | 13 | # Is this a thumbnail? |
7 | 14 | if ( preg_match('!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/\w/\w\w/([^/]*)/' . |
— | — | @@ -186,7 +193,7 @@ |
187 | 194 | $uname = posix_uname(); |
188 | 195 | $server = $uname['nodename']; |
189 | 196 | if ( !in_array($server, array('amane.pmtpa.wmnet', 'storage1', 'ms1', 'ms2')) ) { |
190 | | - $dest = pathFromUrl( $_SERVER['REQUEST_URI'] ); |
| 197 | + $dest = pathFromUrl( $uri ); |
191 | 198 | if( $dest ) { |
192 | 199 | if ( strpos( $dest, '..' ) === false ) { |
193 | 200 | # Make directory and parents |