Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed overwrite in Adapters.FS #4466

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

Aldlevine
Copy link
Contributor

Description of changes

This change solves an issue that would prevent keystone.Storage.Adapters.FS from overwriting a file when whenExists == 'overwrite'. For example, previously the below configuration would return an EEXIST error when the file path being written already exists.

const storage = new keystone.Storage({
  adapter: keystone.Storage.Adapters.FS,
  fs: {
    path: path,
    publicPath: path,
    whenExists: 'overwrite',
    generateFilename: keystone.Storage.contentHashFilename,
  }
});

This issue is resolved by enabling the clobber option in fs-extra.move.

Note: If updating to later versions of fs-extra the clobber option must be changed to overwrite.

Related issues (if any)

#4245 (See comment 2)

Testing

  • Please confirm npm run test-all ran successfully.

Same tests pass/fail as do in current master branch.

@Aldlevine Aldlevine changed the title Fixed in Adapters.FS Fixed overwrite in Adapters.FS Oct 17, 2017
@JedWatson
Copy link
Member

This looks good @Aldlevine, thanks!

@Pyav123
Copy link

Pyav123 commented Apr 11, 2018

Hello,
Anybody still facing this issue? This solution is not working for me.
There two things in this.

@Aldlevine
First, when I installed keystone([email protected] ) I didn't get the fix made keystonejs/keystone@f262c67 for node_modules\keystone\lib\storage\adapters\fs\index.js .

So, Second I tried to copy and paste the adapter fix code (node_modules\keystone\lib\storage\adapters\fs\index.js ) into my node modules but still it isn't working. Can anyone suggest me on this ? I want to upload and overwrite files such as html,css,js etc in CMS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants