From 7d8677e308b26423c2dc2b25a0d5146d855d9a56 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Wed, 17 Aug 2022 11:25:45 +0800 Subject: [PATCH] Fixed static analysis warnings --- packages/static/lib/src/cache.dart | 1 + packages/static/lib/src/virtual_directory.dart | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/static/lib/src/cache.dart b/packages/static/lib/src/cache.dart index b85a2845..df160f66 100644 --- a/packages/static/lib/src/cache.dart +++ b/packages/static/lib/src/cache.dart @@ -194,4 +194,5 @@ class CachingVirtualDirectory extends VirtualDirectory { } } +// TODO: Refactor enum CacheAccessLevel { PUBLIC, PRIVATE } diff --git a/packages/static/lib/src/virtual_directory.dart b/packages/static/lib/src/virtual_directory.dart index 0bcda945..1f96276c 100644 --- a/packages/static/lib/src/virtual_directory.dart +++ b/packages/static/lib/src/virtual_directory.dart @@ -116,7 +116,7 @@ class VirtualDirectory { if (_prefix.isNotEmpty) { // Only replace the *first* incidence // 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 = '.'; @@ -234,7 +234,7 @@ class VirtualDirectory { var href = stub; if (relative.isNotEmpty) { - href = '/' + relative + '/' + stub; + href = '/$relative/$stub'; } if (entity is Directory) { @@ -370,7 +370,7 @@ class VirtualDirectory { 'application/octet-stream'); res.statusCode = 206; 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>().pipe(res); return false; } else {