How to delete files not found in a document in firebase
I’m using quill as text editor in an Angular project. It has an image/video handler that uploads files to firebase. If the user adds an image in the editor the image is uploaded to firebase storage. If the user deletes the image with the keyboard, then the image is deleted from the editor but it keeps stored in the storage. This results in many images uploaded and not being used in any firestore ddocument.
I was thinking about a firebase function in which if an image is not used in any document then it can be deleted at certain time. Not sure how to start.
Another way is to save the uploaded images to an array and then when the editor form is saved it matches the elements in the array vs what it finds in the html saved from the editor in a forestore document. I tried this one but the url is not found. In the below code imageArray is where I’m pushing uploaded urls and then this.noticia.quillContent is what is being stored in firestore document. This returns null, I believe match is not getting the url text within the string.