[Pkg-owncloud-commits] [owncloud] 34/90: Check for version before mounting a public link

David Prévot taffit at moszumanska.debian.org
Fri Feb 6 21:10:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 2fd2b182e7b6711ee827bd5268c3a6e3fbad9ba5
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Mon Jan 5 11:50:05 2015 +0100

    Check for version before mounting a public link
    
    * ownCloud 7.0.0 is needed - version of merge of server <-> server
      sharing - https://github.com/owncloud/core/pull/8399
    * adjust error message
---
 apps/files_sharing/ajax/testremote.php | 3 ++-
 apps/files_sharing/js/public.js        | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/files_sharing/ajax/testremote.php b/apps/files_sharing/ajax/testremote.php
index 8958179..08149bf 100644
--- a/apps/files_sharing/ajax/testremote.php
+++ b/apps/files_sharing/ajax/testremote.php
@@ -14,7 +14,8 @@ function testUrl($url) {
 	try {
 		$result = file_get_contents($url);
 		$data = json_decode($result);
-		return is_object($data) and !empty($data->version);
+		// public link mount is only supported in ownCloud 7+
+		return is_object($data) and !empty($data->version) and version_compare($data->version, '7.0.0', '>=');
 	} catch (Exception $e) {
 		return false;
 	}
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index c4b5508..61807f4 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -210,7 +210,7 @@ OCA.Sharing.PublicApp = {
 			// this check needs to happen on the server due to the Content Security Policy directive
 			$.get(OC.generateUrl('apps/files_sharing/testremote'), {remote: remote}).then(function (protocol) {
 				if (protocol !== 'http' && protocol !== 'https') {
-					OC.dialogs.alert(t('files_sharing', 'No ownCloud installation found at {remote}', {remote: remote}),
+					OC.dialogs.alert(t('files_sharing', 'No ownCloud installation (7 or higher) found at {remote}', {remote: remote}),
 						t('files_sharing', 'Invalid ownCloud url'));
 				} else {
 					OC.redirect(protocol + '://' + url);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list