Skip to content
Snippets Groups Projects

Issue #3182941: Stop assuming a request always exists

1 file
+ 7
5
Compare changes
  • Side-by-side
  • Inline
+ 7
5
@@ -159,12 +159,14 @@ class S3 implements FlysystemPluginInterface, ContainerFactoryPluginInterface {
* The Flysystem configuration.
*/
public static function mergeConfiguration(ContainerInterface $container, array $configuration) {
$protocol = $container->get('request_stack')
->getCurrentRequest()
->getScheme();
$request = $container->get('request_stack')
->getCurrentRequest();
return $configuration += [
'protocol' => $protocol,
if ($request && !isset($configuration['protocol'])) {
$configuration['protocol'] = $request->getScheme();
}
return $configuration + [
'region' => 'us-east-1',
'endpoint' => NULL,
];
Loading