summaryrefslogtreecommitdiffstats
path: root/core/js/share.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/share.js')
-rw-r--r--core/js/share.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/js/share.js b/core/js/share.js
index d8930727cfd..2f126eca32c 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -765,6 +765,25 @@ OC.Share={
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
},
/**
+ * Parses a string to an valid integer (unix timestamp)
+ * @param time
+ * @returns {*}
+ * @internal Only used to work around a bug in the backend
+ */
+ _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;
+ }
+ }
+ return time;
+ },
+ /**
* Displays the expiration date field
*
* @param {Date} date current expiration date
@@ -779,6 +798,8 @@ OC.Share={
minDate: minDate,
maxDate: null
};
+ // TODO: hack: backend returns string instead of integer
+ shareTime = OC.Share._parseTime(shareTime);
if (_.isNumber(shareTime)) {
shareTime = new Date(shareTime * 1000);
}