create new tag
, view all tags

Feature Proposals » Go back to a previous version of an attachment


Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
ParkedProposal   None       KampalaRelease

Edit Form

DateOfCommitment:   Format: YYYY-MM-DD


It is now possible to rollback a version of a topic under the more topic actions . The same feature would be very useful for attachments.

Description and Documentation

A user uploads a new version of an image and then realises that its not the good version. The rollback feature would allow the user to revert to a previous version


The attachment table found at the bottom of each TWiki topic has a manage option for each attachment. Clicking on this manage button brings up the following interface.

  • TWiki attachment manage options:
The above lists all the versions of a particular attachment, in this case like_image_map.gif

The new feature should allow the user to restore a previous version as seen in 'more topic actions' as seen below

  • How a user can restore a topic version:
In the Action column the actions could be view, restore


WhatDoesItAffect: Usability


We can checkout a specfic version of a file with co -rx.x topicname and then force a new version, Or checkout a copy of a version then use the TWik's attach feature.

-- Contributors: PeterJones - 2010-02-15


Useful feature. Could you please add some docs and the user interaction: What add to what screen, what new screen, how a user selects and restores a previous attachment version.

-- PeterThoeny - 2010-02-15

Ping! This is a useful feature. If not Peter Jones, anyone taking this?

Spec needs to be fleshed out first.

-- PeterThoeny - 2010-10-02

Spec is not clear. My two cents:

  • Make it easy and intuitive (point and click)
  • Make it safe to avoid unintended rollback
Possible UI flow:
  • The table that lists revisions has an Action column. Add a restore link as noted above, "the actions could be view, restore ."
  • The restore link leads to a rollback confirm screen that has title restore attachment version, an input field pre-filled with version of previous screen and a [Restore] button.
-- PeterThoeny - 2011-01-17

Ok, having thought about it further it would be safer for the user to first checkout an old version that he/she wants to restore in order to check it. This would avoid unintended rollbacks. I attach changes made to 2 files:

  • attachtables.tmpl this adds the option to checkout a previous version
  • view.pm this changes the viewfile static method. If an extra parameter co is added to the URL then the file is saved locally. Otherwise viewfile runs as before
-- PeterJones - 2011-05-02

Here is a better implementation. The files Upload.pm and attachtables.tmpl are attached to this topic.

  1. The rollback option listed next to view in manage attachment.
  2. The user is requested to confirm the rollback.
  3. The previous version is then read and stored as a new version using $session->{store}->readAttachment and $session->{store}->saveAttachment
-- PeterJones - 2011-07-18

This is long overdue & I support the effort, but have several concerns.

  • There is still the open problem that reverting or even viewing an older topic revision does not use the corresponding versions of attachments.
Please consider your implementation of attachment rollback carefully and ensure that you don't make linking topic revs to attachment revisions harder to solve. At a minimum, I think this requires capturing the topic revision when an attachment is rolled-back.

  • Rolling-back an attachment needs to be logged and attributable to the user who did it. I don't see that happening in the code (but haven't tried it.)

  • Again code reading - I see where you get the old version and write it to working/tmp. I don't see where the /tmp file is removed. And I also worry about name conflicts. And you are blindly untainting whatever filename you get - you're in trouble if a user includes '../' and gets you to do something unfortunate. Why aren't you using File::Temp->new for this? It's easier & safer...
I haven't done a complete review, but these jumped out at me.

Don't let the issues discourage you - this is fundamentally a good idea.

-- TimotheLitt - 2011-07-27

Thank you Pete for posting this code!

At the IstanbulReleaseMeeting2011x08x01 we decided to postpone this feature after TWiki-5.1.0 release.

  • code posted after code freeze
  • code is based on TWiki-4.3, not on trunk
  • more work involved in porting and testing on trunk because feature is not posted as a diff
  • Timothe has some questions

-- PeterThoeny - 2011-08-01

My biggest concern is someone accidentally or intentionally destroying information. In subversion, you can always retrieve old, renamed, and deleted versions. You can even recover an older version of a "deleted" file and put it back into the current revision.

I don't think that's possible with RCS, the current revision-control system being used.

-- SteveKelem - 2012-02-09

I changed the status to ParkedProposal due to long inactivity. Anybody feel free to claim and implement this useful feature.

-- Peter Thoeny - 2015-06-18

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg TWikiAttachmentManage.jpg r1 manage 101.6 K 2010-03-03 - 16:16 PeterJones TWiki attachment manage options
JPEGjpg TWikiOopsMoreRestore.jpg r1 manage 6.5 K 2010-03-03 - 16:23 PeterJones How a user can restore a topic version
Perl source code filepm Upload.pm r1 manage 15.9 K 2011-07-18 - 13:34 PeterJones Upload.pm with new rollbackAttachment sub routine
Perl source code filepm View.pm r1 manage 18.6 K 2011-05-02 - 14:27 PeterJones View.pm with changes made to the method viewfile
Unknown file formattmpl attachtables.tmpl r2 r1 manage 2.7 K 2011-07-18 - 13:33 PeterJones attahtables template with rollback option
Unknown file formattmpl diffAttachtables.tmpl r1 manage 0.9 K 2011-05-02 - 14:25 PeterJones Difference files for view.pm and attachtables.tmpl
Perl source code filepm diffView.pm r1 manage 1.2 K 2011-05-02 - 14:25 PeterJones Difference files for view.pm and attachtables.tmpl
Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r16 - 2015-06-18 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.