xwikisas / application-filemanager

XWiki application to manage a hierarchy of folders and files
GNU Lesser General Public License v2.1
0 stars 4 forks source link

Added attachment to uploaded file replaces it and duplicates itself on FileManager WebHome page #90

Closed petrenkonikita112263 closed 7 months ago

petrenkonikita112263 commented 9 months ago

Note: firstly issue was reproduced on old version File Manager (Pro) 2.4 and XWiki platform 10.11.9

Prerequisites:

Step to reproduce:

  1. Navigate into FileManager.WebHome page
  2. Create a folder with dummy name
  3. Upload file into this folder
  4. Go to a page with an uploaded file, scroll down or select Attachment section from More actions menu
  5. Upload an attachment different name and different type
  6. Refresh the FileManager.WebHome page and check lately created folder

Steps are shown in below GIF firefox_t2w95eJdZl

Actual result: Firstly, you'll not see your file from step 3, instead of it 2 duplications will be present - attachment from step 5, however both links will point to file from step 3 http://localhost:8080/xwiki/bin/view/FileManager/test.txt. Second if you click on this link you will not see content of file from step 3 - content of attachment from step 5

image

If you decide to select one of them, File Manager will automatically select a duplicate. firefox_yPVcIlhpSQ

In addition, if you open your folder in new tab - you will see only one attachment from step 5. image

Expected result: No duplication in FileManager.WebHome and uploaded attachment doesn't replace visually uploaded file.

mflorea commented 7 months ago

@petrenkonikita112263 you need to explain your use case. Why do you need to add an attachment to a File Manager page? What are you trying to achieve? Normally you shouldn't add attachments to the File Manager's pages. You should interact with the File Manager pages through the File Manager UI. I agree that the code could be bulletproofed to ignore the extra attachments, but that's a minor issue.

petrenkonikita112263 commented 7 months ago

Normally you shouldn't add attachments to the File Manager's pages.

I agree with this. However, this type of action can be performed by simple users due to human factors. Admin of XWiki installed and configured File Manager (Pro), and all users should perform CRUD for any files via the pro app. Let's say some users will need to remember the home page of File Manager, but will remember their last event that there's a page with upload files and decide to add files as attachments. Due to this, the admin or other advanced users will see table replacements with duplications.

That's why I opened improvement as an alternative to this.

ChiuchiuSorin commented 7 months ago

No longer needed after implementing https://github.com/xwikisas/application-filemanager/issues/92.