0

I'm pretty new to Keystone as I recently inherited a codebase on a project that used it. We were locked into version 0.2.42 so I just updated to the latest, version 0.3.12 and now I'm having a strange issue. All our models with images use S3 for upload (Types.S3File) and it used to just place the image with the original file name at the root of the specified S3 bucket. Now, however, the files are being renamed with what I'm guessing is a temporary string name. For example if I upload a file called "MyImage.jpg," it will upload as something like "7830c3a6bc7b6790e63de9a3c3716b06.jpg." Is there a new configuration I need to edit to retain the original file name as used to be the case? Thank you for your help.

Seth

budkin
  • 347
  • 3
  • 11

1 Answers1

5

I figured this out with a bit of help over on Github so I figured I'd answer my own question here.

The "Post" Keystone list that the previous programmer had written only had type defined for the image field. I added that filename option as well:

image: {
    type: Types.S3File,
    filename: function(item, filename, originalname){
        return originalname;
    }
},

The original file name is now preserved.

budkin
  • 347
  • 3
  • 11