Skip to content

Commit

Permalink
Checks on resourceid (Public Links) (#2494)
Browse files Browse the repository at this point in the history
Checks on resourceid (Public Links)
  • Loading branch information
refs authored Dec 10, 2019
2 parents 7d05cb0 + 0dc854e commit 6c9a647
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/files/src/components/FileLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default {
$_links () {
return this.links.filter(link => {
return parseInt(link.itemSource) === parseInt(this.highlightedFile.id)
return this.compareIds(link.itemSource, this.highlightedFile.id)
})
},
Expand Down
15 changes: 15 additions & 0 deletions apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ export default {
})
})
},
compareIds (a, b) {
if (!isNaN(a)) { // OC10 autoincrement id
return parseInt(a, 10) === parseInt(b, 10)
} else if (this.isOcisId(b)) {
return a === this.extractOpaqueId(b)
}

return false
},
isOcisId (id) {
return atob(id).split(':').length === 2
},
extractOpaqueId (id) {
return atob(id).split(':')[1]
},
async $_ocUpload_addDropToQue (e) {
const items = e.dataTransfer.items || e.dataTransfer.files

Expand Down

0 comments on commit 6c9a647

Please sign in to comment.