Skip to content

baseUrl has the wrong value because app path has "/test/" in it #1965

Open
@mdebbar

Description

@mdebbar

Here is the relevant code that was copied to dwds. Here is the code in dwds:

const _baseUrlScript = '''
var baseUrl = (function () {
// Attempt to detect --precompiled mode for tests, and set the base url
// appropriately, otherwise set it to '/'.
var pathParts = location.pathname.split("/");
if (pathParts[0] == "") {
pathParts.shift();
}
if (pathParts.length > 1 && pathParts[1] == "test") {
return "/" + pathParts.slice(0, 2).join("/") + "/";
}

We got a report from a user seeing this issue (and I was able to reproduce it, too): flutter/flutter#116360 (comment)

Basically, their app has a path "/sample_item/test/", it trips the generated bootstrap code into thinking that it's in test mode, and it calculates the wrong baseUrl.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-webcustomer-flutterpackage:dwdstriagedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions