Merge branch 'saas-dev' into saas-showbuilder
This commit is contained in:
commit
8609934861
8 changed files with 23 additions and 20 deletions
|
@ -363,14 +363,6 @@ class CcFiles extends BaseCcFiles {
|
|||
unset($response[$key]);
|
||||
}
|
||||
|
||||
$mime = $file->getDbMime();
|
||||
if (!empty($mime)) {
|
||||
// Get an extension based on the file's mime type and change the path to use this extension
|
||||
$path = pathinfo($file->getDbFilepath());
|
||||
$ext = FileDataHelper::getFileExtensionFromMime($mime);
|
||||
$response["filepath"] = ($path["dirname"] . '/' . $path["filename"] . $ext);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -385,8 +377,12 @@ class CcFiles extends BaseCcFiles {
|
|||
public function getFilename()
|
||||
{
|
||||
$info = pathinfo($this->getAbsoluteFilePath());
|
||||
|
||||
//filename doesn't contain the extension because PHP is awful
|
||||
return $info['filename'].".".$info['extension'];
|
||||
$mime = $this->getDbMime();
|
||||
$extension = FileDataHelper::getFileExtensionFromMime($mime);
|
||||
|
||||
return $info['filename'] . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ class CloudFile extends BaseCloudFile
|
|||
if ($this->proxyStorageBackend == null) {
|
||||
$this->proxyStorageBackend = new ProxyStorageBackend($this->getStorageBackend());
|
||||
}
|
||||
return $this->proxyStorageBackend->getDownloadURLs($this->getResourceId());
|
||||
return $this->proxyStorageBackend->getDownloadURLs($this->getResourceId(), $this->getFilename());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,14 @@ class CloudFile extends BaseCloudFile
|
|||
|
||||
public function getFilename()
|
||||
{
|
||||
return $this->getDbFilepath();
|
||||
$filename = $this->getDbFilepath();
|
||||
$info = pathinfo($filename);
|
||||
|
||||
//Add the correct file extension based on the MIME type, for files that were uploaded with the wrong extension.
|
||||
$mime = $this->getDbMime();
|
||||
$extension = FileDataHelper::getFileExtensionFromMime($mime);
|
||||
|
||||
return $info['filename'] . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue