Merge branch 'saas-dev' into saas-showbuilder
This commit is contained in:
commit
8609934861
|
@ -42,12 +42,12 @@ class Amazon_S3StorageBackend extends StorageBackend
|
|||
}
|
||||
|
||||
/** Returns a signed download URL from Amazon S3, expiring in 60 minutes */
|
||||
public function getDownloadURLs($resourceId)
|
||||
public function getDownloadURLs($resourceId, $contentDispositionFilename)
|
||||
{
|
||||
$urls = array();
|
||||
|
||||
$signedS3Url = $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes');
|
||||
|
||||
$s3args = array('ResponseContentDisposition' => 'attachment; filename="' . $contentDispositionFilename. '"');
|
||||
$signedS3Url = $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes', $s3args);
|
||||
|
||||
//If we're using the proxy cache, we need to modify the request URL after it has
|
||||
//been generated by the above. (The request signature must be for the amazonaws.com,
|
||||
|
|
|
@ -13,7 +13,7 @@ class FileStorageBackend extends StorageBackend
|
|||
return $resourceId;
|
||||
}
|
||||
|
||||
public function getDownloadURLs($resourceId)
|
||||
public function getDownloadURLs($resourceId, $contentDispositionFilename)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ class ProxyStorageBackend extends StorageBackend
|
|||
return $this->storageBackend->getAbsoluteFilePath($resourceId);
|
||||
}
|
||||
|
||||
public function getDownloadURLs($resourceId)
|
||||
public function getDownloadURLs($resourceId, $contentDispositionFilename)
|
||||
{
|
||||
return $this->storageBackend->getDownloadURLs($resourceId);
|
||||
return $this->storageBackend->getDownloadURLs($resourceId, $contentDispositionFilename);
|
||||
}
|
||||
|
||||
public function deletePhysicalFile($resourceId)
|
||||
|
|
|
@ -15,7 +15,7 @@ abstract class StorageBackend
|
|||
|
||||
/** Returns the file object's signed URL. The URL must be signed since they
|
||||
* privately stored on the storage backend. */
|
||||
abstract public function getDownloadURLs($resourceId);
|
||||
abstract public function getDownloadURLs($resourceId, $contentDispositionFilename);
|
||||
|
||||
/** Deletes the file from the storage backend. */
|
||||
abstract public function deletePhysicalFile($resourceId);
|
||||
|
|
|
@ -107,8 +107,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
));
|
||||
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
||||
$third_party_api->setDescription(_('Enabling this feature will allow Airtime to provide schedule data
|
||||
to external widgets that can be embedded in your website. Enable this
|
||||
feature to reveal the embeddable code.'));
|
||||
to external widgets that can be embedded in your website.'));
|
||||
$third_party_api->setSeparator(' '); //No <br> between radio buttons
|
||||
//$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list')));
|
||||
$third_party_api->addDecorator('HtmlTag', array('tag' => 'dd',
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,6 +62,7 @@ class Application_Service_MediaService
|
|||
|
||||
if ($media->getPropelOrm()->isValidPhysicalFile()) {
|
||||
$filename = $media->getPropelOrm()->getFilename();
|
||||
|
||||
//Download user left clicks a track and selects Download.
|
||||
if (!$inline) {
|
||||
//We are using Content-Disposition to specify
|
||||
|
|
Loading…
Reference in New Issue