Fixed static analysis warnings

This commit is contained in:
thomashii@dukefirehawk.com 2022-08-17 11:25:45 +08:00
parent f00d3916f6
commit 7d8677e308
2 changed files with 4 additions and 3 deletions

View file

@ -194,4 +194,5 @@ class CachingVirtualDirectory extends VirtualDirectory {
} }
} }
// TODO: Refactor
enum CacheAccessLevel { PUBLIC, PRIVATE } enum CacheAccessLevel { PUBLIC, PRIVATE }

View file

@ -116,7 +116,7 @@ class VirtualDirectory {
if (_prefix.isNotEmpty) { if (_prefix.isNotEmpty) {
// Only replace the *first* incidence // Only replace the *first* incidence
// Resolve: https://github.com/angel-dart/angel/issues/41 // Resolve: https://github.com/angel-dart/angel/issues/41
path = path.replaceFirst(RegExp('^' + _pathify(_prefix)), ''); path = path.replaceFirst(RegExp('^${_pathify(_prefix)}'), '');
} }
if (path.isEmpty) path = '.'; if (path.isEmpty) path = '.';
@ -234,7 +234,7 @@ class VirtualDirectory {
var href = stub; var href = stub;
if (relative.isNotEmpty) { if (relative.isNotEmpty) {
href = '/' + relative + '/' + stub; href = '/$relative/$stub';
} }
if (entity is Directory) { if (entity is Directory) {
@ -370,7 +370,7 @@ class VirtualDirectory {
'application/octet-stream'); 'application/octet-stream');
res.statusCode = 206; res.statusCode = 206;
res.headers['content-length'] = len.toString(); res.headers['content-length'] = len.toString();
res.headers['content-range'] = 'bytes ' + item.toContentRange(total); res.headers['content-range'] = 'bytes ${item.toContentRange(total)}';
await stream.cast<List<int>>().pipe(res); await stream.cast<List<int>>().pipe(res);
return false; return false;
} else { } else {