From a26a11dd5cecc18de4d77850cae3e1dce52e23f8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Jul 2019 14:21:47 +0100 Subject: [PATCH] Remove metadata from share images --- shares.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/shares.py b/shares.py index cf01e349c..674487e2c 100644 --- a/shares.py +++ b/shares.py @@ -18,6 +18,7 @@ from posts import getPersonBox from session import postJson from utils import getNicknameFromActor from utils import getDomainFromActor +from media import removeMetaData def removeShare(baseDir: str,nickname: str,domain: str, \ displayName: str) -> None: @@ -104,22 +105,19 @@ def addShare(baseDir: str,nickname: str,domain: str, \ os.mkdir(baseDir+'/sharefiles/'+nickname) itemIDfile=baseDir+'/sharefiles/'+nickname+'/'+itemID if imageFilename.endswith('.png'): + removeMetaData(imageFilename,itemIDfile+'.png') if moveImage: - os.rename(imageFilename,itemIDfile+'.png') - else: - copyfile(imageFilename,itemIDfile+'.png') + os.remove(imageFilename) imageUrl='/sharefiles/'+nickname+'/'+itemID+'.png' if imageFilename.endswith('.jpg'): + removeMetaData(imageFilename,itemIDfile+'.jpg') if moveImage: - os.rename(imageFilename,itemIDfile+'.jpg') - else: - copyfile(imageFilename,itemIDfile+'.jpg') + os.remove(imageFilename) imageUrl='/sharefiles/'+nickname+'/'+itemID+'.jpg' if imageFilename.endswith('.gif'): + removeMetaData(imageFilename,itemIDfile+'.gif') if moveImage: - os.rename(imageFilename,itemIDfile+'.gif') - else: - copyfile(imageFilename,itemIDfile+'.gif') + os.remove(imageFilename) imageUrl='/sharefiles/'+nickname+'/'+itemID+'.gif' sharesJson[itemID] = {