-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Description
import Url from "url";
import Path from "path";
// Example 1 ==================
let dir = "/uploads/foo/"; // trailing slash
let filename = "bar.jpg";
Url.resolve(dir, filename); // "/uploads/foo/bar.jpg"
Path.resolve(dir, filename); // "/uploads/foo/bar.jpg "
// Url.resolve <=> Path.resolve
// Example 2 ===================
let dir = "/uploads/foo"; // no trailing slash
let filename = "bar.jpg";
Url.resolve(dir, filename); // "/uploads/bar.jpg"
Path.resolve(dir, filename); // "/uploads/foo/bar.jpg"
// // Url.resolve <!=> Path.resolve
I expected from Url.resolve
and Path.resolve
to return the same result with that inputs.
Trailing slash is a weak condition to depend IMO.
Node v4.2.2
OS X 10.9.5
Metadata
Metadata
Assignees
Labels
pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.