Subject: | [PATCH] Does not handle newlines in <Relationship> tags |
MIME-Version: | 1.0 |
X-Mailer: | MIME-tools 5.504 (Entity 5.504) |
X-RT-Interface: | Web |
Message-ID: | <rt-4.0.18-3676-1452529240-521.0-0-0@rt.cpan.org> |
X-RT-Original-Encoding: | utf-8 |
Content-Type: | multipart/mixed; boundary="----------=_1452529240-3676-3" |
X-RT-Encrypt: | 0 |
X-RT-Sign: | 0 |
Content-Length: | 0 |
Content-Disposition: | inline |
Content-Type: | text/plain; charset="utf-8" |
Content-Transfer-Encoding: | binary |
Content-Length: | 432 |
I have a .xlsx file generated by a reporting package that has newlines inside the <Relationship> tags in xl/_rels/workbook.xml.rels:
<Relationship Id="rId1"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
Target="worksheets/sheet1.xml"/>
Spreadsheet::XLSX doesn't handle that, but the fix is simple: just add the /s modifier to the regex so it matches the newlines. Patch is attached.
Subject: | relationship.patch |
MIME-Version: | 1.0 |
Content-Type: | text/x-patch; name="relationship.patch" |
X-Mailer: | MIME-tools 5.504 (Entity 5.504) |
Content-Disposition: | inline; filename="relationship.patch" |
Content-Transfer-Encoding: | binary |
Content-Length: | 378 |
--- lib/Spreadsheet/XLSX.pm 2015-10-30 21:33:19.000000000 -0500
+++ lib/Spreadsheet/XLSX.pm 2016-01-11 09:59:34.913422993 -0600
@@ -253,7 +253,7 @@
my %rels = ();
- foreach ($member_rels->contents =~ /\<Relationship (.*?)\/?\>/g) {
+ foreach ($member_rels->contents =~ /\<Relationship (.*?)\/?\>/gs) {
my ($id, $target);
($id) = /Id="(.*?)"/;