I had one problem with files name set with double quote characters.
Is there a way to clean up the file name when saving the file node?
Thanks

Comments

jvieille’s picture

+1

jvieille’s picture

Category: support » bug

also "/" makes problems: the downloaded file gets what is after the last "/"...
Any means to integrate with transliteration for example?

Thanks

jvieille’s picture

Category: bug » task
Priority: Normal » Major

Quote -'-, double quotes -"- and slash -/- should be avoided apparently.
This is a major issue as it prevents file conversion. I set it as a "task", because it is something unfinished
There may be different option, i.e.
- make FF accept any character in the file name
- or transllitterate file names to get them FF friendly

johanneshahn’s picture

hi,
do u have this characters befor upload the file (as the filename on your desktop),
or just give the file node title this characters?

sorry cant reproduce

jvieille’s picture

The problem is not with the uploaded file, but with the name given to the file node.
Once a file has been uploaded with those characters, letting FF adopt the file name and failing to convert, you can clean up rdf, rename the file and everything goes back to normal.
I would suggest looking at this module
http://drupal.org/project/transliteration
that does the trick (once integrated)

johanneshahn’s picture

Status: Active » Needs review

Tried to fix that in latest dev.
With a minimal filename convertion when
Download, Or use transliteration Module if installed
Goto Admin -> settings -> file

jvieille’s picture

Thanks for working at this.

I was not successful with the feature:
- uploaded files titles are not converted
- downloaded files are not converted either,
I tried both FF setting and Transliteration

However, FF seems to work much better with fancy file names. I can now use any character in the title, and the conversions seem to succeed.

johanneshahn’s picture

hi jvieille,
i fixed that with uploaded files. this works with
file attachments. i do not tested it with cck fields.
for normal file upload this works only in background for
filenames, not for title.

downloading filenames works for me.
can u give me some more input whats going on when u download
a file. do u use the download link or something else?

thank you for review and testing!

jvieille’s picture

I tried again today, and it works when downloading files.
I don't know what happened during my tests, may be a cache problem.

I tried only with file nodes directly, not file attachment nor cck, so this

for normal file upload this works only in background for
filenames, not for title.

seems to apply.
However, I don't understand what you mean, as file names are actually node titles...

johanneshahn’s picture

hi,
if you create a new node of type file
then the title is auto set by javascript and
its not converted.

then you press save/upload your new node the process is.

-> take entered node title as is, because title can have any chars.
-> rename submitted filename/s ($_FILES) with transliteration before processing in ff
this is what i mean with "in background".

this is done via

function file_init() {
  module_load_include('inc', 'file');
  
 // clean filenames before processing with drupal
  if (!empty($_FILES['files'])) {
    // Figure out language, which is available in $_POST['language'] for node
    // forms.
    $langcode = NULL;
    if (!empty($_POST['language'])) {
      $languages = language_list();
      if (isset($languages[$_POST['language']])) {
        $langcode = $_POST['language'];
      }
    }
    foreach ($_FILES['files']['name'] as $field => $filename) {
      // Keep a copy of the unaltered file name.
      $_FILES['files']['orig_name'][$field] = $filename;
      $_FILES['files']['name'][$field] = _file_title_name_clean($filename, $langcode);
    }
  }
}

so in fact the node title, will be converted only on downloads.
and the real filename will be converted only on uploads.

hope u can understand me now ;)

jvieille’s picture

OK - so the file name can be different of its node title? I was under the naive impression that they were the same thing :(.
This might explain why I no longer experience problems :)
where the file name is saved, how can we see it?

johanneshahn’s picture

the filename is then just the bitcache hash after upload it.

jvieille’s picture

So nobody will either see them.. OK!
My guess was right: this solved the problem silently

johanneshahn’s picture

do we close this issue?

jvieille’s picture

Status: Needs review » Fixed
johanneshahn’s picture

Status: Fixed » Closed (fixed)

new feature added