Removed unneeded Uri checks
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c84f6f..9a29a9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.2.1
+
+* Removed `Uri` format checks now that the core libraries is more strict.
+
## 0.2.0
* Removed deprecated `getHandler`.
diff --git a/lib/src/static_handler.dart b/lib/src/static_handler.dart
index 34558e7..a5822cf 100644
--- a/lib/src/static_handler.dart
+++ b/lib/src/static_handler.dart
@@ -38,12 +38,6 @@
}
return (Request request) {
- // TODO: expand these checks and/or follow updates to Uri class to be more
- // strict. https://code.google.com/p/dart/issues/detail?id=16081
- if (request.requestedUri.path.contains(' ')) {
- return new Response.forbidden('The requested path is invalid.');
- }
-
var segs = [fileSystemPath]..addAll(request.url.pathSegments);
var fsPath = p.joinAll(segs);
diff --git a/pubspec.yaml b/pubspec.yaml
index 3103f65..c12bf1e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: shelf_static
-version: 0.2.0
+version: 0.2.1-dev
author: Kevin Moore <github@j832.com>
description: Static file server support for Shelf
homepage: https://github.com/kevmoo/shelf_static.dart
diff --git a/test/alternative_root_test.dart b/test/alternative_root_test.dart
index a7ba8a3..0d40964 100644
--- a/test/alternative_root_test.dart
+++ b/test/alternative_root_test.dart
@@ -59,9 +59,11 @@
schedule(() {
var handler = createStaticHandler(d.defaultRoot);
- return makeRequest(handler, '/static/files/with space.txt',
+ return makeRequest(handler, '/static/files/with%20space.txt',
scriptName: '/static').then((response) {
- expect(response.statusCode, HttpStatus.FORBIDDEN);
+ expect(response.statusCode, HttpStatus.OK);
+ expect(response.contentLength, 18);
+ expect(response.readAsString(), completion('with space content'));
});
});
});
diff --git a/test/basic_file_test.dart b/test/basic_file_test.dart
index c128202..f019684 100644
--- a/test/basic_file_test.dart
+++ b/test/basic_file_test.dart
@@ -61,8 +61,10 @@
schedule(() {
var handler = createStaticHandler(d.defaultRoot);
- return makeRequest(handler, '/files/with space.txt').then((response) {
- expect(response.statusCode, HttpStatus.FORBIDDEN);
+ return makeRequest(handler, '/files/with%20space.txt').then((response) {
+ expect(response.statusCode, HttpStatus.OK);
+ expect(response.contentLength, 18);
+ expect(response.readAsString(), completion('with space content'));
});
});
});