Skip to content

Fix WebView Uri replacing#188

Merged
andycraig merged 1 commit intoREditorSupport:masterfrom
renkun-ken:fix-webview-uri
Jan 24, 2020
Merged

Fix WebView Uri replacing#188
andycraig merged 1 commit intoREditorSupport:masterfrom
renkun-ken:fix-webview-uri

Conversation

@renkun-ken
Copy link
Copy Markdown
Member

@renkun-ken renkun-ken commented Jan 15, 2020

What problem did you solve?

Closes #187

This PR fixes Uri replacing method in showWebView. It is made more robust to only replace non-protocol-specific Uri which points to a local file in htmlwidget source code. For example, in the following HTML tags, only paths starting with lib/ should be replaced with WebView resource Uri, and the last two should not be replaced since they are both protocol-specific Uri.

<script src="lib/htmlwidgets-1.5.1/htmlwidgets.js"></script>
<script src="lib/jquery-1.12.4/jquery.min.js"></script>
<link href="lib/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet" />
<script src="lib/datatables-binding-0.10/datatables.js"></script>
<link href="lib/dt-core-1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" />
<link href="lib/dt-core-1.10.19/css/jquery.dataTables.extra.css" rel="stylesheet" />
<script src="lib/dt-core-1.10.19/js/jquery.dataTables.min.js"></script>
<link href="lib/crosstalk-1.0.0/css/crosstalk.css" rel="stylesheet" />
<script src="lib/crosstalk-1.0.0/js/crosstalk.min.js"></script>
<script src="data:application/javascript;base64,LyohIGhpZ2hsaWd6IlxcUyJ9fSk7"></script>
<script src="https://test.com/lib1.js"></script>

This fixes the handling of script tags created from base64 data uri.

(If you have)Screenshot

image

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

Successfully merging this pull request may close these issues.

Code highlight in reprex output not working

2 participants