Platform
Web
Plugin
package_info_plus
Version
4.0.2
Flutter SDK
3.10.3
Steps to reproduce
Have a Flutter web app with hostElement and have the app embedded in a site of which the name contains a non-word character.
e.g. my-super-file.html ("-" is not a word).
The plugin tries to download the file then from https://www.base.url/my-super-version.json
The problem is the regex https://github.com/fluttercommunity/plus_plugins/blame/ab41d1ac0236e2456686d0c16b9abc17294c08e7/packages/package_info_plus/package_info_plus/lib/src/package_info_plus_web.dart#L24 here.
The regex should be someting like: RegExp(r'[^/]+\.html.*')
Would be great if you could provide a fix.
Regards,
Florian
Code Sample
void main() {
final baseUrl = "https://www.my-site.com/my-super-page.html#/";
final cacheBuster = 1234;
final baseUri = Uri.parse(baseUrl);
//final regExp = RegExp(r'\w+\.html.*'); //original: does not work
final regExp = RegExp(r'[^/]+.html.*'); //fix: does work
final originPath = '${baseUri.origin}${baseUri.path.replaceAll(regExp, '')}';
final versionJson = 'version.json?cachebuster=$cacheBuster';
print("baseUriPath: ${baseUri.path.replaceAll(regExp, '')}");
print(Uri.parse(originPath.endsWith('/')
? '$originPath$versionJson'
: '$originPath/$versionJson'));
}
Logs
html_dart2js.dart:18592 GET https://www.my-page.com/my-super-/version.json?cachebuster=1685985905158 403
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.3, on Ubuntu 20.04.5 LTS 5.15.90.1-microsoft-standard-WSL2, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✗] Linux toolchain - develop for Linux desktop
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
✗ pkg-config is required for Linux development.
It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from https://www.freedesktop.org/wiki/Software/pkg-config/
[!] Android Studio (not installed)
[✓] Connected device (1 available)
[✓] Network resources
Checklist before submitting a bug
Platform
Web
Plugin
package_info_plus
Version
4.0.2
Flutter SDK
3.10.3
Steps to reproduce
Have a Flutter web app with
hostElementand have the app embedded in a site of which the name contains a non-word character.e.g.
my-super-file.html("-" is not a word).The plugin tries to download the file then from
https://www.base.url/my-super-version.jsonThe problem is the regex https://github.com/fluttercommunity/plus_plugins/blame/ab41d1ac0236e2456686d0c16b9abc17294c08e7/packages/package_info_plus/package_info_plus/lib/src/package_info_plus_web.dart#L24 here.
The regex should be someting like:
RegExp(r'[^/]+\.html.*')Would be great if you could provide a fix.
Regards,
Florian
Code Sample
Logs
html_dart2js.dart:18592 GET https://www.my-page.com/my-super-/version.json?cachebuster=1685985905158 403Flutter Doctor
Checklist before submitting a bug
flutter pub upgradeflutter clean