shannah / xataface

Framework for building data-driven web applications in PHP and MySQL
http://xataface.com
GNU General Public License v2.0
134 stars 57 forks source link

DATA LOSS with search + delete #83

Open malaire opened 7 years ago

malaire commented 7 years ago

I just noticed a serious data loss when doing following steps:

1) have a table with several items 2) do search which returns several items 3) open few items from search results into new browser tabs 4) go through those browser tabs and delete each item

In step 4, sometimes wrong items are being deleted, and not those which were selected from search results.

shannah commented 7 years ago

Can you provide the following to help track this down?

  1. Post the URL of the search results. (the query string/portion after '?' is fine)
  2. Post the URL of each item's page that you opened in the browser tabs (query string fine)
  3. If you can share screen shots of each page that would be helpful too.
malaire commented 7 years ago

I just did a new test with clean 2.1.3 install to confirm this.

Exact steps:

...?-table=Test&-search=item&-action=list&-submit=Search+Test

...?-table=Test&-search=item&-action=browse&-submit=Search+Test&-cursor=0&-skip=0&-limit=30&-mode=list&-recordid=Test%3FTestID%3D1 ...?-table=Test&-search=item&-action=browse&-submit=Search+Test&-cursor=1&-skip=0&-limit=30&-mode=list&-recordid=Test%3FTestID%3D2 ...?-table=Test&-search=item&-action=browse&-submit=Search+Test&-cursor=2&-skip=0&-limit=30&-mode=list&-recordid=Test%3FTestID%3D3

...?-table=Test&-search=item&-action=delete&-submit=Search+Test&-cursor=0&-skip=0&-limit=30&-mode=list&-recordid=Test%3FTestID%3D1&-delete-one=1

...?-table=Test&-search=item&-action=delete&-submit=Search+Test&-cursor=1&-skip=0&-limit=30&-mode=list&-recordid=Test%3FTestID%3D2&-delete-one=1

!!! THIS PAGE IS WRONG, it is asking 'Are you sure you want to delete this record: "Third Item"?' !!!

It seems that Xataface is using search-parameters to decide which record to delete, and completely ignoring '-recordid' in the URL. So when first record from search is deleted, the subsequent deletions will delete wrong records.

itmuecke commented 1 year ago

I can confirm this also. My workaround: reload search result after each delete. But even than deletion feels risky. Lost a lot of data due to this bug :(