/** @var ISecureRandom */
protected $random;
+ private ?string $bundlePath = null;
+
/**
* @param \OC\Files\View $view relative to data/
* @param IConfig $config
if (!Filesystem::isValidPath($name) or Filesystem::isFileBlacklisted($name)) {
throw new \Exception('Filename is not valid');
}
+ $this->bundlePath = null;
$dir = $this->getPathToCertificates() . 'uploads/';
if (!$this->view->file_exists($dir)) {
if (!Filesystem::isValidPath($name)) {
return false;
}
+ $this->bundlePath = null;
+
$path = $this->getPathToCertificates() . 'uploads/';
if ($this->view->file_exists($path . $name)) {
$this->view->unlink($path . $name);
*/
public function getAbsoluteBundlePath(): string {
try {
- if (!$this->hasCertificates()) {
- return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
- }
+ if (!$this->bundlePath) {
+ if (!$this->hasCertificates()) {
+ $this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+ }
- if ($this->needsRebundling()) {
- $this->createCertificateBundle();
- }
+ if ($this->needsRebundling()) {
+ $this->createCertificateBundle();
+ }
- return $this->view->getLocalFile($this->getCertificateBundle());
+ $this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ }
+ return $this->bundlePath;
} catch (\Exception $e) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}