#30 Using "preview" button when editing can lose data

closed-fixed
None
5
2003-02-12
2003-02-12
Steve McIntyre
No

There's a problem in the way that preview works - it is
possible for editors to overwrite other people's
changes in the following circumstance (seen today on
the Wiki in the office):

User A edits WikiFile
User B edits WikiFile
User A saves WikiFile
User B previews WikiFile
User B saves WikiFile

This last one _should_ show the "somebody else edited
the page" error message, but doesn't...

Simple checking of the code in Page::send_editor()
shows an obvious bug - the timestamp used to guard
against conflicting changes is reset each time the
preview is shown. An easy fix is to store the date
stamp for the _start_ of the editing session in the
hidden datestamp form field. Only set this to the mtime
of the existing file on the first pass through the edit
call. The attached patch works for me...

Discussion

  • Steve McIntyre
    Steve McIntyre
    2003-02-12

    • summary: Using "preview" button when editing can lose data --> Using "preview" button when editing can lose data
     
  • Steve McIntyre
    Steve McIntyre
    2003-02-12

    Simple fix

     
    Attachments
  • Logged In: YES
    user_id=39128

    Fixed, using only 3 more lines ;)

     
    • assigned_to: nobody --> jhermann
    • summary: Using "preview" button when editing can lose data --> Using "preview" button when editing can lose data
    • status: open --> closed-fixed