Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regexp path patern's not all checked #670

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion package/lib/src/beam_guard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,13 @@ class BeamGuard {
}
} else {
final regexp = Utils.tryCastToRegExp(pathPattern);
return regexp.hasMatch(path);
final result = regexp.hasMatch(path);

if (result) {
return true;
} else {
continue;
}
}
}
return false;
Expand Down
2 changes: 2 additions & 0 deletions package/lib/src/beam_stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ abstract class BeamStack<T extends RouteInformationSerializable>
/// If this is false (default), then a path pattern '/some/path' will match
/// '/' and '/some' and '/some/path'.
/// If this is true, then it will match just '/some/path'.
///
/// __This only applies if the pattern is of type STRING, not REGEXP__
bool get strictPathPatterns => false;

/// Creates and returns the list of pages to be built by the [Navigator]
Expand Down
8 changes: 7 additions & 1 deletion package/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ abstract class Utils {
}
} else {
final regexp = tryCastToRegExp(pathPattern);
return regexp.hasMatch(uri.toString());
final result = regexp.hasMatch(uri.toString());

if (result) {
return true;
} else {
continue;
}
}
}
return false;
Expand Down
Loading