trannamtrung1st / elFinder.Net.Core

An elFinder backend connector with less magic code and more compatibility. This enables .NET Standard 2.0 projects to easily integrate elFinder functionalities.
Apache License 2.0
12 stars 8 forks source link

Javascript warnings "The volume root statuses requires `volumeid` property" #20

Closed huwjeffries closed 2 years ago

huwjeffries commented 2 years ago

When running the demos, if I open the debugging console in the web browser I see lots of javascript warnings saying: "The volume root statuses requires volumeid property"

This is because the current working directory (CWD) property doesn't have a volumeid property. The fix for this would be to change the return type of IDirectoryExtensions -> ToFileInfoAsync to be Task DirectoryInfoResponse instead of Task BaseInfoResponse You'll also want to change the first parameter of InitResponse's and OpenResponse's constructors to be "DirectoryInfoResponse cwd" instead of "BaseInfoResponse cwd". Finally change the cwd property in OpenResponse to be: public DirectoryInfoResponse cwd { get; protected set; }

Thanks!

trannamtrung1st commented 2 years ago

Hi @huwjeffries , what version are you using? I cannot reproduce it with the version 1.3.4 and above since I remember I already fixed it before.

trannamtrung1st commented 2 years ago

As you see here, although the return type is BaseInfoResponse but it is actual the DirectoryInfoResponse which contains the volumeid property so it will be there when the API returns response to the browser. image

huwjeffries commented 2 years ago

Apologies - I checked out the source code and added it as projects to my solution so I could easily step through the code, rather than installing the nuget. I've targeted net 6, so there will be a difference in how the json serialisation works. You're welcome to close this issue.

Thanks.

On Sun, 20 Feb 2022, 03:04 Trung Tran, @.***> wrote:

As you see here, although the return type is BaseInfoResponse but it is actual the DirectoryInfoResponse which contains the volumeid property so it will be there when the API returns response to the browser. [image: image] https://user-images.githubusercontent.com/40495531/154826698-2f034368-68e3-4a48-a794-9b4f31b0779d.png

— Reply to this email directly, view it on GitHub https://github.com/trannamtrung1st/elFinder.Net.Core/issues/20#issuecomment-1046149486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3ICIFCKKGUQHZQD26N7WLU4BK3HANCNFSM5O2TTD3Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

trannamtrung1st commented 2 years ago

Oh I understand now. I think we could use some workaround for this issue as Microsoft suggested for System.Text.Json. I already used the raw property names (without PascalCase) in the response models to avoid the need to use Json libraries but still cannot eliminate all the issues 😄
One more solution is to replace the BaseInfoResponse type in the models by the object type... but I still doubt it.