mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 07:51:17 +01:00
get rid of path.resolve
This doesn't handle '..' and other things that path.resolve does, but if you're passing weird things to a URL, your fault.
This commit is contained in:
parent
22ea5a7e27
commit
79ab296f1f
@ -44,9 +44,8 @@ function request_id() {
|
|||||||
// splits a URL path into an Array
|
// splits a URL path into an Array
|
||||||
// the path is resolved and decoded
|
// the path is resolved and decoded
|
||||||
function path_list(pathname) {
|
function path_list(pathname) {
|
||||||
// remove trailing and double slashes + other junk
|
// remove double and trailing slashes
|
||||||
|
pathname = pathname.replace(/\/\/+/g, "/").replace(/\/$/, "");
|
||||||
pathname = path.resolve(pathname);
|
|
||||||
var list = pathname.split("/");
|
var list = pathname.split("/");
|
||||||
list.shift();
|
list.shift();
|
||||||
for (var i = 0; i < list.length; i++) {
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user