Microsoft/TypeScript

Public APIs not normalizing paths

Open

#9.486 geöffnet am 2. Juli 2016

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: APIHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

As discussed in this issue, the parseJsonConfigFileContent public API can fail on Windows when passed non-normalized paths (that is, paths containing backslash delimiters).

It appears that this is not the only public API with which this occurs. The following two public API functions call getDirectoryPath with non-normalized paths:

The first of these has caused numerous issue with tsify:

Is there any guidance regarding how module authors are supposed to use public TypeScript APIs that accept paths? Are paths always expected to be normalized? If so, that puts a burden on module developers. Would it not be preferable for the parseJsonConfigFileContent, findConfigFile, resolveTripleslashReference functions to normalize any paths before calling functions - like getDirectoryPath - that expect/assume normalized paths?

Contributor Guide