owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.77k stars 3.05k forks source link

Handle error 423 (locked file) #4285

Closed parneet-guraya closed 5 months ago

parneet-guraya commented 6 months ago

Fixes: #4282

What this PR includes?

https://github.com/owncloud/android/assets/111801812/5a395242-3125-4c7d-90b1-8fc38aaa17fa

@jesmrec The reason I believe this exception occurs is when file is being accessed, like in this case when the video is being fetched and we try to remove the file then it throws the exception.

parneet-guraya commented 6 months ago

@JuancaG05 hey could you give it a quick look :-)

JuancaG05 commented 5 months ago

I'll take a look ASAP. In this case @Aitorbp will take a look as well so that he gets familiar with how errors flow from network responses to UI 🙂

parneet-guraya commented 5 months ago

I updated with requested changes 👍

jesmrec commented 5 months ago

Testing the PR i notice a side-effect (not regressive):

  1. Lock a picture file
  2. Open the picture in the app to preview it
  3. Remove the picture from the preview

snackbar is not displayed

Locking a file can be easily done in oC10 servers. Log in an admin account > Settings (top right menu) > General (left menu, admin side) > tick Enable manual file locking in the web interface

Once enabled, every file (not folder) in the list will have an option Lock file available. Operations over the locked file will return 423

This could be fixed here or moved to another PR.

All the places in which i tested and the message appears are correct.

Tested with different kind of files and previews (pictures, txt, video), performing operations: Move, Remove, Move, Rename (operations not allowed for a locked file). All of them fine.

parneet-guraya commented 5 months ago

@jesmrec Will check and push the hotfix here if it's simple enough otherwise we can solve it by raising another issue

parneet-guraya commented 5 months ago

Hi @jesmrec, I have been using demo.owncloud.com for accessing limited demo server. So, I think this one does not have the privilege to enable/disable file locking and you mentioned admin account and I'm not sure how to get access to that. Can you help out here? :-)

jesmrec commented 5 months ago

demo.owncloud.com can be accessed with admin/admin credentials. Then, the steps mentioned above. Let me know if you run into any trouble.

parneet-guraya commented 5 months ago

@jesmrec Hi, the case you said, I was able to reproduce at first attempt. After investigating, the error was getting thrown correctly but at UI level the throwable turns out to be null (couldn't get the chance to see further) that's why it was showing the generic unknown error message.

But, now I can't reproduce it anymore. Let me know if you still see this otherwise we may push this one and later on create separate issue and pickup from there if it ever starts coming again.

https://github.com/owncloud/android/assets/111801812/32446f43-d9f6-42f6-8d83-336106e7e346

jesmrec commented 5 months ago

i don't see the unknown message anymore, when i try to remove a picture from its preview, there is no snackbar. I still reproduce this consistently, but, as i commented, it's not a regression.

Let's move this forward and i will create another issue since it seems that reproducing is not so straightforward.

JuancaG05 commented 5 months ago

Need a rebase here if you don't mind @parneet-guraya 😄.

BTW, to automatize changelog, we are using a tool called Calens since some time ago. What we need to do is adding in each PR a plain text file in a certain folder with certain features for it to be recognised. Do you feel like adding them from now on? You can find more info here, and one example here (but you can check all of our PR to see more examples 😉). Just if you want, otherwise we can take care of it, thanks! 👍

parneet-guraya commented 5 months ago

Sure, I can do it :-)

parneet-guraya commented 5 months ago

I did add the changelog file in unreleased dir as the doc says. Do I also need to add into Changelog.md file?