summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/shareitemmodel.js22
-rw-r--r--core/js/tests/specs/shareitemmodelSpec.js2
2 files changed, 22 insertions, 2 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index e0d44586613..ff0d3a6d800 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -656,7 +656,7 @@
}
var permissions = this.get('possiblePermissions');
- if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions)) {
+ if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions) && data.reshare.uid_owner !== OC.currentUser) {
permissions = permissions & data.reshare.permissions;
}
@@ -723,6 +723,26 @@
permissions: permissions,
allowPublicUploadStatus: allowPublicUploadStatus
};
+ },
+
+ /**
+ * 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;
}
});
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 2f676a4ba1f..c1d820052e2 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -274,7 +274,7 @@ describe('OC.Share.ShareItemModel', function() {
['0x12345', null],
[ '', null],
], function(value) {
- expect(OC.Share._parseTime(value[0])).toEqual(value[1]);
+ expect(OC.Share.ShareItemModel.prototype._parseTime(value[0])).toEqual(value[1]);
});
});