Archived from the Transloadit support forum. Originally posted on February 28, 2014; details may be outdated, see our docs for current behavior. Original thread
Is there a way to get a Transloadit robot to replace periods in filenames (other than the extension)?
unfortunately that’s not possible at the moment. Do you mind posting about your use case? Maybe we can figure out a way to work around this requirement.
Thanks for your reply Tim. We have an application written in Flash 6, ActionScript 1 that loads images using Flash’s loadMovie() method. Unfortunately, Flash will not load a movie with multiple periods in the filename. Which seems absolutely insane, but that seems to be the bottom line. If we upload the same file without periods in the filename, Flash happily loads it. We thought about renaming the file after Transloadit finished processing it. We already do that with the files our assembly uploads to our CDN. But our assembly also uploads the files to S3, and files can’t be renamed in S3. So we’re stuck between a rock and a hard place. At this point we’re basically going to have to stop the upload if any of the images have multiple periods in the filenames and tell the user multiple periods aren’t allowed.
well you have full control over the “path” parameter of our “/s3/store” robot, so for the file name you could use something like “${file.id}.${file.ext}” which would force it to only have one period in the file name.
Let me know if this helps or if I misunderstood something.
I just got around to investigating this further. I do not see any reference to ${file.id} in the Assembly Variables section of the docs. There’s a ${file.name} variable which does not help because periods are not replaced in that variable. Nor are periods replaced in ${file.url_basename} variable. Only characters other than A-Za-z0-9-_. are replaced in that variable. Our system cannot handle a filename that contains a period other than the one separating the basename from the extension. Which leads me to conclude I’ll have to reject the upload on my end if any of the filenames contain multiple periods.
No worries, that’s our fault for not having documented it yet. The file.id is a random string that we assign to files that does not contain any spaces or periods or things like that. It’s not the slugged version of the filename, no.
Will the id already work for your usecase though or do you need something else more?