summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-28 14:20:55 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-29 14:58:56 +0200
commitfc3ce8441e3a33b312fca3ea352ce1297a51a37d (patch)
tree43531ec89a01da429eb0c3242d6df36296b09e11
parent47d25989dc974879827925f72d904548785a1828 (diff)
downloadnextcloud-server-fc3ce8441e3a33b312fca3ea352ce1297a51a37d.tar.gz
nextcloud-server-fc3ce8441e3a33b312fca3ea352ce1297a51a37d.zip
tests for _parseTime with hex and empty strings
-rw-r--r--core/js/share.js4
-rw-r--r--core/js/tests/specs/shareSpec.js2
2 files changed, 6 insertions, 0 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 94833a8d915..2f126eca32c 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 22632a2bd2e..eaeba79797c 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]);
});