Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

bug-fix : Custom generateFilename is Not working#5

Open
GwonHyeok wants to merge 1 commit intokeystonejs:masterfrom
GwonHyeok:master
Open

bug-fix : Custom generateFilename is Not working#5
GwonHyeok wants to merge 1 commit intokeystonejs:masterfrom
GwonHyeok:master

Conversation

@GwonHyeok
Copy link

when using generateFileName as Storage option
generateFilename option is not working

because keystone-storage-adapter-s3 can be used only DEFAULT_OPTIONS.generateFilename
So I made the generateFilename option to work
thanks you

const storage = new keystone.Storage({
    adapter: require('keystone-storage-adapter-s3'),
    s3: {
        path: '/files',
        region: 'ap-northeast-1',
        headers: {
            'x-amz-acl': 'public-read'
        },
    },
    schema: {
        bucket: true,
        etag: true,
        path: true,
        url: true,
    },
    generateFilename: customGenerateFileName // it does not working
});

generateFilename options is not working
@JedWatson
Copy link
Member

@GwonHyeok this looks like a configuration issue, not a bug in the s3 adapter:

generateFilename should be passed in the s3 options, not the top level. Like this:

const storage = new keystone.Storage({
    adapter: require('keystone-storage-adapter-s3'),
    s3: {
        path: '/files',
        region: 'ap-northeast-1',
        headers: {
            'x-amz-acl': 'public-read'
        },
        generateFilename: customGenerateFileName, // <-- here
    },
    schema: {
        bucket: true,
        etag: true,
        path: true,
        url: true,
    },
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants