-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checks on resourceid (Public Links) #2494
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,16 @@ export default { | |
}) | ||
}) | ||
}, | ||
compareIds (x, y) { | ||
if (!isNaN(x)) { // OC10 autoincrement id | ||
return parseInt(x) === parseInt(y) | ||
} else if (atob(y).split(':').length === 2) { // OC10: https://github.com/cs3org/reva/blob/e7830e2f752a05a081178ed26c384ced983b8fde/internal/http/services/owncloud/ocdav/ocdav.go#L169-L175 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is something we'll do more in the future for extracting the id, maybe we need a separate function for just extraction ? something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now thinking, maybe this should me done on SDK level. The SDK is here to abstract away whether Webdav, OCS or CS3 is being used to avoid having API-specific logic in the frontend code. @DeepDiver1975 thoughts ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure this is going to stay this way, perhaps @butonic can shed a bit more light, as the only place I found this requirement is alone in the reva code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @butonic any comments here ? if we don't know let's add a "TODO: move to common location or library" then |
||
const opaqueid = atob(y).split(':')[1] // https://cs3org.github.io/cs3apis/#cs3.storageproviderv0alpha.ResourceId | ||
return x === opaqueid | ||
} | ||
|
||
return false | ||
}, | ||
async $_ocUpload_addDropToQue (e) { | ||
const items = e.dataTransfer.items || e.dataTransfer.files | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseInt(x, 10) === parseInt(y, 10)
. without this leading zeroes would cause Javascript to parse numbers as octal...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was was aware of the radix problem but was blatantly relying on ES5 definition:
the definition applies also on
Number
ES6:In any case, a check for hex would make it less error prone, but octal should not be a concern, unless someone's using a version older than ES5... .
In any case, to make things clear I'd add the radix 💃