Feature Proposal: Allow Renaming of Attachments

Motivation

I would like to rename attachments for the same reasons that I rename topics - users make mistakes, and sometimes the mistakes are not obvious until long after the fact. Similarly, users change their minds.

The desire to rename attachments is not new. I found a tmwiki feature request to rename attachments, dating back to 2003 (the discussion from which I have included below).

The only way to rename an attachment via the browser is to delete it and re-upload under the new name. That destroys the attachment's history.

Description and Documentation

Crawford reports that the code is already there to rename attachments - all that is missing is the UI.

The user should be allowed to change the attachment extension. For example, I might want to rename FROG.GIF to frog.gif.

The UI should provide the option of changing topics that referenced the attachment's old name, just like the UI for renaming topics.

Examples

Impact

WhatDoesItAffect:

Implementation

-- Contributors: MichaelTempest - 13 Aug 2009

Discussion

From tmwiki feature request

There are many times when changing the name an attached file is listed as in the FileAttachment table would be very helpful. A user recently uploaded multiple chapters to a document we were working on and included the version number in the file name. (They did not yet understand TWiki's file version tracking system.) Of course, after the next revision, the file names displayed in the table were misleading. The only way I could change the file names was to delete all those files and upload the same files with new names.

I noticed that you can actually replace a file with a new file that has a totally different name (by clicking on "action" and then upload a file with a different name) and yet the name displayed in the table remains unchanged. If I then This suggests to me that the displayed name is not actually linked to the file it refers to. So why not create a way for the user to change the name displayed for an attachment?

Perhaps we should simply provide an option for designating what a file is refered to when it is uploaded - and then allow this to be modified. This approach would address some of the unanswered questions posed in AttachWithDiffName.

-- LynnwoodBrown - 21 May 2003

As far as I can tell, the attachment feature in TWiki works exactly as it was designed. My point has to do with usability design and, as far as I can tell, will require programming new features that are not there currently. I suppose the line between poor usability and a bug is not quite as clear-cut as this - but I still think this is closer to a feature request than a bug.

I'd really like to know is how hard would it be to accommodate this change in how attachments are handled. Any core team members or other knowledgeable folks willing to comment on this?

-- LynnwoodBrown - 21 May 2003

This shouldn't be that difficult to achieve, but the rename function that does topic renaming/moving and attachement moving is already fairly complex.

-- JohnTalintyre - 22 May 2003

Cases that must be considered

Renaming a file A to B can collide with an existing File B
When a rename action matchs a filename already exist, the renaming nomally should be prevented by displaying an Error: "Filename B already exist, cannot rename file"

Of course if File B is the predecessor of A the renaming could update File B (timestamp B < A) and delete File A, but this is too complex and would end up in an inadequate high implementation effort.
Preserve filetype
Renaming of files should not touch the filetype as this would make the file inaccessable in most cases. So only the name before the last dot should be changeable

-- AndreUlrich - 28 Feb 2004

Foswiki discussion

From today's IRC:

[11:18] <MTempest> On Foswiki, how do you rename an attachment?
...
[11:43] <OliverKrueger> afaik there is no way other than delete and re-upload to rename an attachment (filename).
[11:45] <MTempest> That's what I thought - in which case you lose the history for that attachment.
[11:45] <OliverKrueger> true
[11:46] <MTempest> I know I could rename the file at file-system level and fix the topic metadata by hand.
[11:47] <MTempest> But users don't generally have command-line access.
[11:47] <OliverKrueger> You can write a plugin to do that.
[11:47] <OliverKrueger> But it should be a job for the core.
[11:49] * MTempest creates task to capture the issue
[11:51] <OliverKrueger> im not sure, but I think, there was a feature request already...
[12:05] <CDot> Foswiki::Func::moveAttachment
[12:07] <CDot> it appears the functionality goes all the way up to just below the UI
[12:07] <OliverKrueger> a sideeffect of UI stability... ;)
[12:07] <CDot> all that's missing are oldattachment and newattachment params to Manage::rename
[12:08] <CDot> sorry, i take that back; 'attachment' and 'newattachment' will rename an attachment
[12:09] <CDot> so no code changes required to support it
...
[12:12] <CDot> MTempest: well, looks like it just needs someone to design a UI

-- MichaelTempest - 13 Aug 2009

Renaming attachments has been implemented in trunk. The interface needs some work, for example there is no screen/form to rename an attachment without moving it. Follow up in Tasks.Item2523.

-- ArthurClemens - 22 Dec 2009
Topic revision: r2 - 22 Dec 2009, ArthurClemens
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy