GithubHelp home page GithubHelp logo

Comments (6)

jacobvr avatar jacobvr commented on June 15, 2024

+1 problem exists. Uploading file adds it to s3 bucket, but deleting file from keystone is not deleting it from s3 bucket.

from keystone-storage-adapter-s3.

PhilCuster avatar PhilCuster commented on June 15, 2024

For future reference, until this problem is fixed it is best to use a post-hook to delete it manually. Something like this should do the trick:

Image.schema.post('remove', function (doc) {
    // Delete the file from the your adapter here.
    
});

from keystone-storage-adapter-s3.

Avcajaraville avatar Avcajaraville commented on June 15, 2024

Yeah, this is very problematic for my current set up.

On remove hook, is all fine, but what if trying to delete an image when editing a post ?

In that case, the updateItem method of FileType is call, and no way of hooking there, so I cant delete my images on S3... :(

from keystone-storage-adapter-s3.

internetErik avatar internetErik commented on June 15, 2024

I'm trying to delete a file when it is removed or switched, and not only when the entire document is deleted. I know I can use a pre save hook to get an opportunity to delete the file, but I need the old value. I was thinking that I could get the old value by storing it while in a setter, but this hasn't worked.

Document.schema.path('file.filename').set(function(newVal) {
  this._oldFileFilename = this.file.filename;
  return newVal;
});

Before I include this setter, it seems that the filename is added on the object as normal, but with the setter it is no longer added. Is my setter perhaps conflicting with one added by this project? (I haven't looked into this yet, I was wondering if anyone else has tried this).

from keystone-storage-adapter-s3.

bish0p86 avatar bish0p86 commented on June 15, 2024

This is still an issue or am I missing something? I cannot remove images from S3 at all... As mentioned above it removes db entry but does not fire S3Adapter.prototype.removeFile any suggestions?

from keystone-storage-adapter-s3.

conghai avatar conghai commented on June 15, 2024

+1

from keystone-storage-adapter-s3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.