From 2104b5376142d594230cc9f7c5441734a98f9552 Mon Sep 17 00:00:00 2001 From: Xabi Spacebiker Date: Thu, 28 Sep 2017 11:12:57 +0200 Subject: [PATCH 1/4] Update pypofile.py Adding user write permission in cached file --- python_apps/pypo/pypo/pypofile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/pypo/pypo/pypofile.py b/python_apps/pypo/pypo/pypofile.py index df7e4f12d..9363bf6db 100644 --- a/python_apps/pypo/pypo/pypofile.py +++ b/python_apps/pypo/pypo/pypofile.py @@ -84,7 +84,7 @@ class PypoFile(Thread): handle.write(chunk) #make file world readable - os.chmod(dst, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) + os.chmod(dst, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) if media_item['filesize'] == 0: file_size = self.report_file_size_and_md5_to_airtime(dst, media_item["id"], host, username) From 90e91b1a55cccb27c7d581437b9b4d50526bb3b8 Mon Sep 17 00:00:00 2001 From: Xabi Spacebiker Date: Thu, 28 Sep 2017 11:21:35 +0200 Subject: [PATCH 2/4] Update Schedule.php Removing double slash from $uri, not the solution of permission issue but it won't hurt. getStationUrl will always return a slash at the end, so we do not need to add it again in line 1033 --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index ad8ea50cc..e74fc1563 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -1030,7 +1030,7 @@ SQL; $file = $storedFile->getPropelOrm(); //Even local files are downloaded through the REST API in case we need to transform //their filenames (eg. in the case of a bad file extension, because Liquidsoap won't play them) - $uri = Application_Common_HTTPHelper::getStationUrl() . "/rest/media/" . $media_id; + $uri = Application_Common_HTTPHelper::getStationUrl() . "rest/media/" . $media_id; //$uri = $file->getAbsoluteFilePath(); $filesize = $file->getFileSize(); From 418e46c5d8eec6f9f78a04a9f53ff6e3383fefbc Mon Sep 17 00:00:00 2001 From: Xabi Spacebiker Date: Thu, 28 Sep 2017 11:23:32 +0200 Subject: [PATCH 3/4] Update HTTPHelper.php We want getStationUrl to return a slash at the end, so we add it if missing --- airtime_mvc/application/common/HTTPHelper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/common/HTTPHelper.php b/airtime_mvc/application/common/HTTPHelper.php index 80a40e2fc..5f06a3f9d 100644 --- a/airtime_mvc/application/common/HTTPHelper.php +++ b/airtime_mvc/application/common/HTTPHelper.php @@ -37,6 +37,9 @@ class Application_Common_HTTPHelper if ($baseDir[0] != "/") { $baseDir = "/" . $baseDir; } + if ($baseDir[strlen($baseDir)-1] != "/") { + $baseDir = $baseDir . "/"; + } $scheme = "http"; if ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { @@ -102,4 +105,4 @@ class ZendActionHttpException extends Exception { parent::__construct($message, $code, $previous); } -} \ No newline at end of file +} From 715df8418f645cf4ef12dff3ef6b2ee6e94f15ee Mon Sep 17 00:00:00 2001 From: Xabi Spacebiker Date: Fri, 29 Sep 2017 12:21:13 +0200 Subject: [PATCH 4/4] Update HTTPHelper.php --- airtime_mvc/application/common/HTTPHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/common/HTTPHelper.php b/airtime_mvc/application/common/HTTPHelper.php index 5f06a3f9d..80e6fd16e 100644 --- a/airtime_mvc/application/common/HTTPHelper.php +++ b/airtime_mvc/application/common/HTTPHelper.php @@ -37,7 +37,7 @@ class Application_Common_HTTPHelper if ($baseDir[0] != "/") { $baseDir = "/" . $baseDir; } - if ($baseDir[strlen($baseDir)-1] != "/") { + if (substr($baseDir, -1) != "/") { $baseDir = $baseDir . "/"; }