Convert pre-existing filenames

colan - December 10, 2007 - 21:54
Project:Transliteration
Version:6.x-2.0
Component:Code
Category:bug report
Priority:critical
Assigned:smk-ka
Status:active
Description

I wanted to rename files that already existed before I installed and enabled the module. Here's a patch I came up with that will allow administrators to perform this action.

It looks like there's now a newer module for this. Perhaps this patch could be incorporated somehow?

AttachmentSize
convert.patch3.61 KB

#1

colan - December 21, 2007 - 04:15

I've created a newer issue for this, for the newer module, over at http://drupal.org/node/202884.

#2

sun - June 8, 2008 - 05:04
Project:Transliterate filenames» Transliteration
Version:5.x-1.0» 5.x-1.0

#3

Freso - June 11, 2008 - 21:45

Transliteration 6.x-1.0+ does this. So, not having looked at your code, perhaps you could look at the code in the 6.x branch and see if it is backportable?

#4

colan - June 12, 2008 - 17:11

I doubt I'll get a chance to do this. Perhaps someone else can take this and run with it?

#5

smk-ka - June 12, 2008 - 21:48
Version:5.x-1.0» 5.x-2.0
Assigned to:Anonymous» smk-ka
Status:needs review» fixed

The .install file from the DRUPAL-6--1 branch is now a part of DRUPAL-5--2, the upcoming 2.0 release.

#6

Anonymous (not verified) - June 26, 2008 - 21:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#7

sun - November 10, 2008 - 20:41
Title:Convert preexisting filenames» Convert pre-existing filenames
Status:closed» active

I'm lucky that I've read the changelog prior installing Transliteration on an existing site. While this feature makes sense, it has the possibility of breaking existing download URLs in contents or links on external sites. That is why the original patch implemented a confirmation form that warns the user about possible implications of this action.

IMHO, this should really be an opt-in feature. Maybe a constant in the .install file.

#8

Justin W Freeman - November 18, 2008 - 06:18

I agree with Sun, this should really be an opt-in feature. Maybe a constant in the .install file or button on a settings page.

#9

eigentor - March 9, 2009 - 00:15

I had the same problem. If you got inline images, this can be downright dangerous.

Loads of images can vanish. Please make the retroactive conversion optional.

#10

emdalton - March 9, 2009 - 18:33

I just had a whole bunch of file attachment links on my site break because files were retroactively renamed. :( At minimum, this needs to be mentioned in the Readme, and ideally a warning should be presented before the conversion of pre-existing file names takes place. It would be better to have this as an option, however.

I suppose there's no going back now. I didn't notice the problem on the same day as I installed this module, so we'd lose too much data by reverting to a backup.

Could a utility be developed to sanitize URLs within nodes, to help us recover?

#11

eigentor - March 10, 2009 - 12:44
Priority:normal» critical

Changed the status to critical - because this may cause people serious trouble. Imagine someone having several thousand files, and a fith is erroneuosly converted.

There is also a problem with imagefield - imagefield creates .thumb.jpg files in the D6 version for the preview thumbnails in the upload widget. Snce these files are not in the files table, their names are not transliterated. But since Imagefield appears to create the name it looks for from the original filename, it cannot find those files anymore - in consequence all the widgets are there but no thumb images anymore, if the file name was transliterated.

#12

emdalton - March 12, 2009 - 22:16

It looks like the modules "scanner", "node find replace" and "search and replace" may be able to go through and fix the broken links, but I need to know what all the "sanitized" substitutions were.

#13

Jody Lynn - April 7, 2009 - 17:20
Version:5.x-2.0» 6.x-2.0
Category:feature request» bug report

This burned me as well. In my case I enabled the module on a production site, thinking it would clean up new file uploads, and it managed to change filepaths on a bunch of my files without updating the records in the files table. (This particular anomaly was probably related to my use of private_upload module). To fix it I ran

update files set filepath = REPLACE (filepath, " ", "_");

to get rid of the spaces left in the files table that didn't match the new filepaths.

 
 

Drupal is a registered trademark of Dries Buytaert.