Browse Source

Forcing flysystem downloads to be language neutral (#137)

* Forcing flysystem downloads to be language neutral

* Coder....
pull/729/head
dannylamb 6 years ago committed by Natkeeran
parent
commit
ea2236ab31
  1. 21
      src/Flysystem/Fedora.php

21
src/Flysystem/Fedora.php

@ -4,6 +4,7 @@ namespace Drupal\islandora\Flysystem;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Url;
use Drupal\flysystem\Plugin\FlysystemPluginInterface;
use Drupal\flysystem\Plugin\FlysystemUrlTrait;
use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
@ -116,4 +117,24 @@ class Fedora implements FlysystemPluginInterface, ContainerFactoryPluginInterfac
return [];
}
/**
* {@inheritdoc}
*/
public function getExternalUrl($uri) {
$path = str_replace('\\', '/', $this->getTarget($uri));
$arguments = [
'scheme' => $this->getScheme($uri),
'filepath' => $path,
];
// Force file urls to be language neutral.
$undefined = \Drupal::languageManager()->getLanguage('und');
return Url::fromRoute(
'flysystem.serve',
$arguments,
['absolute' => TRUE, 'language' => $undefined]
)->toString();
}
}

Loading…
Cancel
Save