@@ -314,7 +314,15 @@ public function testXAccelMapping($realpath, $mapping, $virtual)
314
314
$ property ->setValue ($ response , $ file );
315
315
316
316
$ response ->prepare ($ request );
317
- $ this ->assertEquals ($ virtual , $ response ->headers ->get ('X-Accel-Redirect ' ));
317
+ $ header = $ response ->headers ->get ('X-Accel-Redirect ' );
318
+
319
+ if ($ virtual ) {
320
+ // Making sure the path doesn't contain characters unsupported by nginx
321
+ $ this ->assertMatchesRegularExpression ('/^([^?%]|%[0-9A-F]{2})*$/ ' , $ header );
322
+ $ header = rawurldecode ($ header );
323
+ }
324
+
325
+ $ this ->assertEquals ($ virtual , $ header );
318
326
}
319
327
320
328
public function testDeleteFileAfterSend ()
@@ -361,6 +369,7 @@ public static function getSampleXAccelMappings()
361
369
['/home/Foo/bar.txt ' , '/var/www/=/files/,/home/Foo/=/baz/ ' , '/baz/bar.txt ' ],
362
370
['/home/Foo/bar.txt ' , '"/var/www/"="/files/", "/home/Foo/"="/baz/" ' , '/baz/bar.txt ' ],
363
371
['/tmp/bar.txt ' , '"/var/www/"="/files/", "/home/Foo/"="/baz/" ' , null ],
372
+ ['/var/www/var/www/files/foo%.txt ' , '/var/www/=/files/ ' , '/files/var/www/files/foo%.txt ' ],
364
373
];
365
374
}
366
375
0 commit comments