Skip to content

Commit

Permalink
Merge pull request #1288 from bcgov/dev-NK-13.0-merge
Browse files Browse the repository at this point in the history
move zipper changes to dev for 13.0 release
  • Loading branch information
nkan-aot2 authored Jan 30, 2025
2 parents 8d60b60 + 790145b commit 562b08a
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions computingservices/ZippingServices/services/zipperservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import json
import traceback
import PyPDF2
from os import path

def processmessage(message):
try:
Expand Down Expand Up @@ -113,16 +114,18 @@ def __zipfilesandupload(_message, s3credentials):

_docbytes = __getdocumentbytearray(fileobj, s3credentials)
_formattedbytes = None

try:
_formattedbytes = __removesensitivecontent(_docbytes)
if _formattedbytes is not None:
print("_formattedbytes length is {0}".format(len(_formattedbytes)))
else:
print("_formattedbytes is none")
except Exception:
print("error happened while removing sensitive content of {0} ".format(filename))
print(traceback.format_exc())
_filename, extension = path.splitext(fileobj["s3uripath"])

if extension.lower() == '.pdf':
try:
_formattedbytes = __removesensitivecontent(_docbytes)
if _formattedbytes is not None:
print("_formattedbytes length is {0}".format(len(_formattedbytes)))
else:
print("_formattedbytes is none")
except Exception:
print("error happened while removing sensitive content of {0} ".format(filename))
print(traceback.format_exc())
#added a space to try out code merge on git. 18-Sept-2024
zip.writestr(
filename, _docbytes if _formattedbytes is None else _formattedbytes
Expand Down Expand Up @@ -172,4 +175,4 @@ def __getzipfilepath(foldername, filename):
foldername.capitalize() + "/" + filename + ".zip"
if foldername is not None
else filename + ".zip"
)
)

0 comments on commit 562b08a

Please sign in to comment.