You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bind function can accept this, which is an object (path).
However, in the bind function, this._router.route(path) receives this object.
This object is passed to path-to-regexp.
In path-to-regexp v0.1.7, the object is converted to a string without causing an error.
In path-to-regexp v0.1.10, encountering an object can cause the program to crash.
This is the reason for the program crash after the update.
The version that found the problem was 0.1.10, but this error was thrown in 0.1.11.
if(typeofpath!=='string'){thrownewTypeError('path must be a string, array of strings, or regular expression');}
imgA:
imgB:
In imgA, httpolyglot passed an object, which was concatenated into a string in path-to-regexp 0.1.7, and the program had no errors. However, in later versions of path-to-regexp, my use case ran into errors because the object could not be handled "friendly".
If you decide to upgrade path-to-regexp, should you keep old programs compatible without causing them to crash? What is the right way to do it? Do you not handle the app passed in when bind?
The text was updated successfully, but these errors were encountered:
env
see:
Code Analysis:
see:
express/lib/application.js
Line 489 in 7e562c6
step:
methods
includesbind
.app
has abind
function.bind
function can acceptthis
, which is an object (path
).bind
function,this._router.route(path)
receives this object.path-to-regexp
.path-to-regexp
v0.1.7, the object is converted to a string without causing an error.path-to-regexp
v0.1.10, encountering an object can cause the program to crash.The version that found the problem was 0.1.10, but this error was thrown in 0.1.11.
imgA:
imgB:
In imgA, httpolyglot passed an object, which was concatenated into a string in path-to-regexp 0.1.7, and the program had no errors. However, in later versions of path-to-regexp, my use case ran into errors because the object could not be handled "friendly".
If you decide to upgrade path-to-regexp, should you keep old programs compatible without causing them to crash? What is the right way to do it? Do you not handle the app passed in when bind?
The text was updated successfully, but these errors were encountered: