Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
jvoisin
mat2
Commits
62c205ff
Commit
62c205ff
authored
Mar 08, 2020
by
jvoisin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the coverage
parent
74157396
Pipeline
#35664
failed with stages
in 2 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
libmat2/office.py
libmat2/office.py
+7
-7
No files found.
libmat2/office.py
View file @
62c205ff
...
...
@@ -313,12 +313,12 @@ class MSOfficeParser(ZipParser):
def
__randomize_creationId
(
full_path
:
str
)
->
bool
:
try
:
tree
,
namespace
=
_parse_xml
(
full_path
)
except
ET
.
ParseError
as
e
:
except
ET
.
ParseError
as
e
:
# pragma: no cover
logging
.
error
(
"Unable to parse %s: %s"
,
full_path
,
e
)
return
False
if
'p14'
not
in
namespace
.
keys
():
return
True
return
True
# pragma: no cover
for
item
in
tree
.
iterfind
(
'.//p14:creationId'
,
namespace
):
item
.
set
(
'val'
,
'%s'
%
random
.
randint
(
0
,
2
**
32
))
...
...
@@ -329,12 +329,12 @@ class MSOfficeParser(ZipParser):
def
__randomize_sldMasterId
(
full_path
:
str
)
->
bool
:
try
:
tree
,
namespace
=
_parse_xml
(
full_path
)
except
ET
.
ParseError
as
e
:
except
ET
.
ParseError
as
e
:
# pragma: no cover
logging
.
error
(
"Unable to parse %s: %s"
,
full_path
,
e
)
return
False
if
'p'
not
in
namespace
.
keys
():
return
True
return
True
# pragma: no cover
for
item
in
tree
.
iterfind
(
'.//p:sldMasterId'
,
namespace
):
item
.
set
(
'id'
,
'%s'
%
random
.
randint
(
0
,
2
**
32
))
...
...
@@ -362,7 +362,7 @@ class MSOfficeParser(ZipParser):
elif
full_path
.
endswith
(
'/word/document.xml'
):
# this file contains the revisions
if
self
.
__remove_revisions
(
full_path
)
is
False
:
return
False
return
False
# pragma: no cover
elif
full_path
.
endswith
(
'/docProps/app.xml'
):
# This file must be present and valid,
# so we're removing as much as we can.
...
...
@@ -386,10 +386,10 @@ class MSOfficeParser(ZipParser):
f
.
write
(
b
'<a:tblStyleLst def="{%s}" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/>'
%
uid
)
elif
full_path
.
endswith
(
'ppt/presentation.xml'
):
if
self
.
__randomize_sldMasterId
(
full_path
)
is
False
:
return
False
return
False
# pragma: no cover
if
self
.
__remove_rsid
(
full_path
)
is
False
:
return
False
return
False
# pragma: no cover
if
self
.
__remove_nsid
(
full_path
)
is
False
:
return
False
# pragma: no cover
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment