-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Devil in the details: File ID javascript limit #30434
Comments
Yet another t-shirt? 😆 |
Is this just a test case or a real life use case ? It is known that JS has issues with bigger numbers. Now for the file id I guess we could switch the web UI to use strings everywhere. Not sure about other numbers though where arithmetic is needed (ex: sizes) |
@PVince81 real case we hit yesterday. The first action I took to mitigate it was to change the file id to string in the JS fileInfo model, but that will break at least sharing. Explanation: Unfortunately, I think the change has to be done also on server side: all responses sending a item_source, file_source, file_id need to be converted to string |
json has no understanding of types - values are all strings. Fixing this in pure js side should do the job from my understanding |
I'm already looking into this. I see some additional unit tests failing. In general I think this is a likely dangerous change as it will affect apps that expect the file id to be an int. |
You might be right about sharing: the sharing code also stores the file id in "item_source" and "file_source" as int, so this will need additional changes there. |
@DeepDiver1975 unfortunately, JSON has notion of types, being Number one of them: @PVince81 I agree is a dangerous change, but I think is a change that needs to be introduced to support big deployments, else the software will not be able to support the needs and hacks will be needed to keep it running. |
hmmm - so we send this as 'file_id': 12345 and is interpreted as int then - too bad I had this different in mind - thx for the enlightenment |
@DeepDiver1975 for the parts that parse Webdav it can already work as what we get is strings. The part we need to look at is when returning file id as int from JSON objects. Going to look at the sharing code. Will need to change the API code to return "item_source" and "file_source" as strings. WIP PR here: #30435 |
@PVince81 thanks for the quick reaction. In order to not break compatibility you might add just another field: This is the solution adopted by Twitter in their public API.
|
For my test cases: |
ToDo @phil-davis & @individual-it make UI test run using problematic ids |
Hi @PVince81 I re-open, as I think there are missing points to cover, specially on the server side. |
This issue has been automatically closed. |
@DeepDiver1975 @felixboehm @butonic @PVince81
We have hit an issue that may impact other big ownCloud deployments.
ownCloud relies on a file id to be an integer, currently the size has been increased server-side to unsigned 64 bits: #26901
The problem is that Javascript only support numerical precision up to 2^53.
Long story short: the fileInfo model in JS relies on the fileId to be a number and it calls parseInt("file id") but if the number is bigger than 2^53 results in an erratic conversion, see image:
Result: every server side application relying on the file Id sent from the browser will fail as the file id is not correct and can point to an non-existing file or to another file in other user home directory.
The solution for this problem is to make the file ID a string and not a number, the sync client took this sage decision long time ago.
Cheers,
Hugo
The text was updated successfully, but these errors were encountered: