[Pkg-owncloud-commits] [owncloud] 03/24: tests for _parseTime with hex and empty strings

David Prévot taffit at moszumanska.debian.org
Wed Sep 2 13:30:14 UTC 2015


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

taffit pushed a commit to annotated tag v8.0.7RC1
in repository owncloud.

commit fc3ce8441e3a33b312fca3ea352ce1297a51a37d
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Tue Jul 28 14:20:55 2015 +0200

    tests for _parseTime with hex and empty strings
---
 core/js/share.js                 | 4 ++++
 core/js/tests/specs/shareSpec.js | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/core/js/share.js b/core/js/share.js
index 94833a8..2f126ec 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -772,6 +772,10 @@ OC.Share={
 	 */
 	_parseTime: function(time) {
 		if (_.isString(time)) {
+			// skip empty strings and hex values
+			if (time === '' || (time.length > 1 && time[0] === '0' && time[1] === 'x')) {
+				return null;
+			}
 			time = parseInt(time, 10);
 			if(isNaN(time)) {
 				time = null;
diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js
index 22632a2b..eaeba79 100644
--- a/core/js/tests/specs/shareSpec.js
+++ b/core/js/tests/specs/shareSpec.js
@@ -844,6 +844,8 @@ describe('OC.Share tests', function() {
 				[  123456 , 123456],
 				['0123456', 123456],
 				['abcdefg',   null],
+				['0x12345',   null],
+				[       '',   null],
 			], function(value) {
 				expect(OC.Share._parseTime(value[0])).toEqual(value[1]);
 			});

-- 
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