Skip to content

Commit

Permalink
fix BFF notify bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Patterbear committed Oct 25, 2024
1 parent 2e33218 commit 1482d4c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docubleach/bleach.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ def remove_bff_macros(file, notify):
if stream[0] in bff_macro_folders:
macro_streams.append(stream)

# Replace macro stream contents with empty bytes
for macro_stream in macro_streams:
macro_stream_size = ole.get_size(macro_stream)
ole.write_stream(macro_stream, bytes(bytearray(macro_stream_size)))
macro_stream_contents = ole.openstream(macro_stream).read(macro_stream_size)

if len(macro_streams) > 0:
macros_found = True
# Check each macro stream to see if it's already empty (bleached)
if macro_stream_contents != bytes(bytearray(macro_stream_size)):
# Replace macro stream contents with empty bytes
ole.write_stream(macro_stream, bytes(bytearray(macro_stream_size)))
macros_found = True

if file_type == "ppt":
streams = OleFileIO(file).listdir(streams=True)
Expand Down

0 comments on commit 1482d4c

Please sign in to comment.