Replaced Uri.encodeFull with Uri.encodeComponent to load html data correctly on Web platform

This commit is contained in:
Lorenzo Pichilli 2022-11-25 12:39:04 +01:00
parent 0f203484a1
commit ae4471d4c0
5 changed files with 10 additions and 7 deletions

View File

@ -1,3 +1,7 @@
## 6.0.0-beta.17
- Replaced `Uri.encodeFull` with `Uri.encodeComponent` to load html data correctly on Web platform
## 6.0.0-beta.16
- Removed Android Hybrid Composition constraint to use the pull-to-refresh feature

View File

@ -71,7 +71,7 @@ void loadData() {
if (!kIsWeb) {
expect(currentUrl, TEST_CROSS_PLATFORM_URL_1.toString());
} else {
expect(currentUrl, 'data:$mimeType,' + Uri.encodeFull(data));
expect(currentUrl, 'data:$mimeType,' + Uri.encodeComponent(data));
}
pageLoads.close();

View File

@ -3,12 +3,11 @@
export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/3.3.6"
export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"

View File

@ -280,7 +280,7 @@ class InAppWebViewWebElement implements Disposable {
final String contentType =
httpRequest.getResponseHeader('content-type') ?? 'text/html';
return 'data:$contentType,' +
Uri.encodeFull(httpRequest.responseText ?? '');
Uri.encodeComponent(httpRequest.responseText ?? '');
}
String getIFrameId() {
@ -298,7 +298,7 @@ class InAppWebViewWebElement implements Disposable {
Future<void> loadData(
{required String data, String mimeType = "text/html"}) async {
iframe.src = 'data:$mimeType,' + Uri.encodeFull(data);
iframe.src = 'data:$mimeType,' + Uri.encodeComponent(data);
}
Future<void> loadFile({required String assetFilePath}) async {

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
version: 6.0.0-beta.16
version: 6.0.0-beta.17
homepage: https://inappwebview.dev/
repository: https://github.com/pichillilorenzo/flutter_inappwebview
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues