-
-
Notifications
You must be signed in to change notification settings - Fork 69
fix: unescape hyperlink attrs + parse unprefixed drawing tags #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,20 +202,20 @@ impl OneCellAnchor { | |
| reader, | ||
| Event::Start(ref e) => { | ||
| match e.name().into_inner() { | ||
| b"xdr:from" => { | ||
| b"xdr:from" | b"from" => { | ||
| self.from_marker.set_attributes(reader, e); | ||
| } | ||
| b"xdr:grpSp" => { | ||
| b"xdr:grpSp" | b"grpSp" => { | ||
| let mut obj = GroupShape::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_group_shape(obj); | ||
| } | ||
| b"xdr:sp" => { | ||
| b"xdr:sp" | b"sp" => { | ||
| let mut obj = Shape::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_shape(obj); | ||
| } | ||
| b"xdr:pic" => { | ||
| b"xdr:pic" | b"pic" => { | ||
| let mut obj = Picture::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_picture(obj); | ||
|
Comment on lines
+208
to
221
|
||
|
|
@@ -224,16 +224,16 @@ impl OneCellAnchor { | |
| } | ||
| }, | ||
| Event::Empty(ref e) => { | ||
| if e.name().into_inner() == b"xdr:ext" { | ||
| if matches!(e.name().into_inner(), b"xdr:ext" | b"ext") { | ||
| self.extent.set_attributes(reader, e); | ||
| } | ||
| }, | ||
| Event::End(ref e) => { | ||
| if e.name().into_inner() == b"xdr:oneCellAnchor" { | ||
| if matches!(e.name().into_inner(), b"xdr:oneCellAnchor" | b"oneCellAnchor") { | ||
| return | ||
| } | ||
| }, | ||
| Event::Eof => panic!("Error: Could not find {} end element", "xdr:oneCellAnchor") | ||
| Event::Eof => panic!("Error: Could not find {} end element", "oneCellAnchor") | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,33 +342,33 @@ impl TwoCellAnchor { | |
| reader, | ||
| Event::Start(ref e) => { | ||
| match e.name().into_inner() { | ||
| b"xdr:from" => { | ||
| b"xdr:from" | b"from" => { | ||
| self.from_marker.set_attributes(reader, e); | ||
| } | ||
| b"xdr:to" => { | ||
| b"xdr:to" | b"to" => { | ||
| self.to_marker.set_attributes(reader, e); | ||
| } | ||
| b"xdr:grpSp" => { | ||
| b"xdr:grpSp" | b"grpSp" => { | ||
| let mut obj = GroupShape::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_group_shape(obj); | ||
| } | ||
| b"xdr:graphicFrame" => { | ||
| b"xdr:graphicFrame" | b"graphicFrame" => { | ||
| let mut obj = GraphicFrame::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_graphic_frame(obj); | ||
| } | ||
| b"xdr:sp" => { | ||
| b"xdr:sp" | b"sp" => { | ||
| let mut obj = Shape::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_shape(obj); | ||
| } | ||
| b"xdr:cxnSp" => { | ||
| b"xdr:cxnSp" | b"cxnSp" => { | ||
| let mut obj = ConnectionShape::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_connection_shape(obj); | ||
| } | ||
| b"xdr:pic" => { | ||
| b"xdr:pic" | b"pic" => { | ||
|
Comment on lines
+351
to
+371
|
||
| let mut obj = Picture::default(); | ||
| obj.set_attributes(reader, e, drawing_relationships); | ||
| self.set_picture(obj); | ||
|
|
@@ -377,11 +377,11 @@ impl TwoCellAnchor { | |
| } | ||
| }, | ||
| Event::End(ref e) => { | ||
| if e.name().into_inner() == b"xdr:twoCellAnchor" { | ||
| if matches!(e.name().into_inner(), b"xdr:twoCellAnchor" | b"twoCellAnchor") { | ||
| return | ||
| } | ||
| }, | ||
| Event::Eof => panic!("Error: Could not find {} end element", "xdr:twoCellAnchor") | ||
| Event::Eof => panic!("Error: Could not find {} end element", "twoCellAnchor") | ||
| ); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new XML-unescaping for
location,tooltip, and relationship targets changes hyperlink semantics and is meant to fix escaped query parameters. There doesn’t appear to be a regression test asserting that a hyperlink with an escaped attribute/relationship target (e.g. containing&) is read back as the unescaped string, or thattooltipis preserved. Adding an integration test fixture (or a minimal constructed xlsx) that exercises these cases would help prevent future regressions.