Fix slash in chromium path. (flutter/engine#51527)

The previous code here introduced an extra slash. Our test platform was tolerant to this extra slash and essentially ignored it, but this probably won't work for most hosting solutions. I went ahead and added some extra validation to the URL when fetching so that we won't serve URLs that have the double slash in their path, in order to catch this if it regresses again.
This commit is contained in:
Jackson Gardner 2024-03-19 13:05:26 -07:00 committed by GitHub
parent 1b0240f093
commit 7aa5194894
2 changed files with 2 additions and 2 deletions

View File

@ -485,7 +485,7 @@ class BrowserPlatform extends PlatformPlugin {
request.url.path,
));
if (!fileInDirectory.existsSync()) {
if (request.url.path.contains('//') || !fileInDirectory.existsSync()) {
return shelf.Response.notFound('File not found: ${request.url.path}');
}

View File

@ -17,7 +17,7 @@ export const loadCanvasKit = (deps, config, browserEnvironment, engineRevision)
const useChromiumCanvasKit = supportsChromiumCanvasKit && (config.canvasKitVariant !== "full");
let baseUrl = config.canvasKitBaseUrl ?? `https://www.gstatic.com/flutter-canvaskit/${engineRevision}/`;
if (useChromiumCanvasKit) {
baseUrl = `${baseUrl}/chromium/`;
baseUrl = `${baseUrl}chromium/`;
}
let canvasKitUrl = `${baseUrl}canvaskit.js`;
if (deps.flutterTT.policy) {