File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ export default class Share {
4343 ocsData . hide_download = ! ! ocsData . hide_download
4444 ocsData . mail_send = ! ! ocsData . mail_send
4545
46- if ( ocsData . attributes ) {
46+ if ( ocsData . attributes && typeof ocsData . attributes === 'string' ) {
4747 try {
4848 ocsData . attributes = JSON . parse ( ocsData . attributes )
4949 } catch ( e ) {
50- console . warn ( 'Could not parse share attributes returned by server: "' + ocsData . attributes + '"' )
50+ console . warn ( 'Could not parse share attributes returned by server' , ocsData . attributes )
5151 }
5252 }
5353 ocsData . attributes = ocsData . attributes ?? [ ]
@@ -310,7 +310,7 @@ export default class Share {
310310 * @memberof Share
311311 */
312312 get label ( ) {
313- return this . _share . label
313+ return this . _share . label ?? ''
314314 }
315315
316316 /**
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ export default {
453453 return this .share .type === this .SHARE_TYPES .SHARE_TYPE_GROUP
454454 },
455455 isNewShare () {
456- return this .share .id === null || this . share . id === undefined
456+ return ! this .share .id
457457 },
458458 allowsFileDrop () {
459459 if (this .isFolder && this .config .isPublicUploadEnabled ) {
@@ -718,13 +718,10 @@ export default {
718718
719719 },
720720 handleShareType () {
721- if (this .share .share_type ) {
722- this .share .type = this .share .share_type
723- }
724- // shareType 0 (USER_SHARE) would evaluate to zero
725- // Hence the use of hasOwnProperty
726721 if (' shareType' in this .share ) {
727722 this .share .type = this .share .shareType
723+ } else if (this .share .share_type ) {
724+ this .share .type = this .share .share_type
728725 }
729726 },
730727 handleDefaultPermissions () {
@@ -745,7 +742,7 @@ export default {
745742 this .sharingPermission = ' custom'
746743 this .advancedSectionAccordionExpanded = true
747744 this .setCustomPermissions = true
748- } else {
745+ } else if ( this . share . permissions ) {
749746 this .sharingPermission = this .share .permissions .toString ()
750747 }
751748 },
You can’t perform that action at this time.
0 commit comments