Hi all,
I want to automate saving all pdf's that are send to a specific email address to a folder on our local file system.
The problem is that some pdf's contain special characters ("/") that need to be stripped before saving the file. Also, I only want pdf's, not images (from a signature), to be saved and not the pdf's that contain certain words.
I found some how-to's on how to do this, but now my other functions aren't working anymore.
This is the flow I have right now:


createArray('@','ß','²','³','µ','´','°','^','=','(',')','&','$','§', '~','#','%','*',':','<','>','?','/','|',' ')
("§" symbol is used internally to indicate that the email needs a manual check)
replace(variables('Sanitize'), item(), '')
The flow works except for the last part; it does create the pdf with the correct name, but the file size changes and when the flow is finished, the pdf is corrupted. I think what's going on is the flow is saving each attachment it finds in the email and saving it to one file. If I look at the Teams messages Flow sends me, there are 6 messages, and in the email, there are also 6 attachments: one good pdf - the one I need, one pdf that needs to be filtered and 4 images that are in the email signature. If I send an email that does not contain any other pdf files or images in the signature, all works fine.
This is my first flow and I think it can be a huge timesaver for our business if I get the hang of it, any help is appreciated.