Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas
This commit is contained in:
commit
d312c844bc
|
@ -214,6 +214,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$whiteList = $this->removeBlacklistedFieldsFromRequestData($requestData);
|
||||
$whiteList = $this->stripTimeStampFromYearTag($whiteList);
|
||||
|
||||
if (!$this->validateRequestData($file, $whiteList)) {
|
||||
$file->save();
|
||||
|
@ -479,5 +480,21 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
exec("find $path -empty -type d -delete");
|
||||
}
|
||||
|
||||
/*
|
||||
* It's possible that the year tag will be a timestamp but Airtime doesn't support this.
|
||||
* The year field in cc_files can only be 16 chars max.
|
||||
*
|
||||
* This functions strips the year field of it's timestamp, if one, and leaves just the year
|
||||
*/
|
||||
private function stripTimeStampFromYearTag($metadata)
|
||||
{
|
||||
if (isset($metadata["year"])) {
|
||||
if (preg_match("/^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{2}):(\d{2}):(\d{2}))?$/", $metadata["year"])) {
|
||||
$metadata["year"] = substr($metadata["year"], 0, 4);
|
||||
}
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue