File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,8 @@ class WebAssetServer implements AssetReader {
350
350
351
351
// For real files, use a serialized file stat plus path as a revision.
352
352
// This allows us to update between canvaskit and non-canvaskit SDKs.
353
- final String etag = file.lastModifiedSync ().toIso8601String () + file.path;
353
+ final String etag = file.lastModifiedSync ().toIso8601String ()
354
+ + Uri .encodeComponent (file.path);
354
355
if (ifNoneMatch == etag) {
355
356
return shelf.Response .notModified ();
356
357
}
Original file line number Diff line number Diff line change @@ -324,6 +324,18 @@ void main() {
324
324
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
325
325
}));
326
326
327
+ test ('serves valid etag header for asset files with non-ascii chracters' , () => testbed.run (() async {
328
+ globals.fs.file (globals.fs.path.join ('build' , 'flutter_assets' , 'fooπ' ))
329
+ ..createSync (recursive: true )
330
+ ..writeAsBytesSync (< int > [1 , 2 , 3 ]);
331
+
332
+ final Response response = await webAssetServer
333
+ .handleRequest (Request ('GET' , Uri .parse ('http://foobar/assets/fooπ' )));
334
+ final String etag = response.headers[HttpHeaders .etagHeader];
335
+
336
+ expect (etag.runes, everyElement (predicate ((int char) => char < 255 )));
337
+ }));
338
+
327
339
test ('handles serving missing asset file' , () => testbed.run (() async {
328
340
final Response response = await webAssetServer
329
341
.handleRequest (Request ('GET' , Uri .parse ('http://foobar/assets/foo' )));
You can’t perform that action at this time.
0 commit comments