Skip to content
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

hyperlink with query arguments corrupts workbook #275

Closed
maksimlikharev opened this issue Mar 2, 2017 · 3 comments
Closed

hyperlink with query arguments corrupts workbook #275

maksimlikharev opened this issue Mar 2, 2017 · 3 comments

Comments

@maksimlikharev
Copy link

Found quite nasty bug.
If you include xml unsafe characters into url, resulted workbook is not readable,
this is especially true if you have query params where & is a separator.

This is due to relation target stored in the xml attribute.

following chars must be xml encoded:

"  
'   
<  
>  
&  
@guyonroche
Copy link
Collaborator

@maksimlikharev I've just tried to reproduce this and I'm having trouble...
The following (unlikely) hyperlink saves fine and opens in Excel:

    ws.getCell('A1').value = {
      text:'Somewhere with query params',
      hyperlink: 'www.somewhere.com?a=1&b=2&c=<>&d="\'"'
    };

Could you post some example code that causes your issue?

@maksimlikharev
Copy link
Author

This is what we do.

exceljs: 0.3.0

One important detail I forgot to mention, this is streaming mode.

let rowData = {};

rowData['url'] = { text: 'text', hyperlink: 'http://localhost/getsome?sss=1&bbb=2&ccc=<>' }

this.workbook.getWorksheet(1).addRow(rowData);

row.commit();

@guyonroche
Copy link
Collaborator

@maksimlikharev - just pushed 0.4.1 with a fix.
Thanks for raising this :-)
Let me know if this fixes your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants