extension() long name
Closed this issue · 1 comments
I hit a bug with extension(), it only happen in Angular (Web) projects, this may be related to dart2js
:
To reproduce create a stagehand
angular project, add path: ^1.6.2
and following code in main.dart :
import 'package:angular/angular.dart';
import 'package:buga/app_component.template.dart' as ng;
import 'package:path/path.dart' as path;
void main() {
print("EXT : " + path.extension("Xxx: Xxxxxxx xx x'xxxxx xxxxxxxxxx XXXXXX xxxxxxxx xx xxxxxx xxxxxxxxxx xxxxx x° xxx xxx xxx, xxxxxxxx xxxxxx xxx xxxxxxxxxx xxxxxx xxxxx x° xxx xxx xxx xx xxxxxx xxxxxxx xx xxxxxx xxxxxxxxxx xxxxx x° xxx xxx xxx.eml"));
runApp(ng.AppComponentNgFactory);
}
will output an empty extension (expected result is .eml
):
EXT :
Not that in a console application this works as expexed
$ dart --version
Dart VM version: 2.3.0 (Unknown timestamp) on "linux_x64"
This is not related to the length, it is caused by the :
character. When you run on the web the default Style
is Style.url
. For this style, when we see a colon character we consider that part of the "root", not the "path". We parse until we see a /
and consider that the start of the "path".
For example p.Style.url.context.rootPrefix('https://www.google.com/foo/bar')
is https://www.google.com
. The "path" here is /foo/bar
.