Microsoft/TypeScript

Public APIs not normalizing paths

开放

#9,486 创建于 2016年7月2日

 (4 条评论) (0 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
BugDomain: APIHelp Wanted

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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?

贡献者指南