Escape special characters in resolved content base path (#9650)
* Refactor * Escape special characters in the content pattern base path * Update changelog
This commit is contained in:
parent
547f9f674a
commit
e63c111c03
2 changed files with 11 additions and 8 deletions
|
|
@ -94,17 +94,18 @@ function parseFilePath(filePath, ignore) {
|
|||
* @returns {ContentPath}
|
||||
*/
|
||||
function resolveGlobPattern(contentPath) {
|
||||
contentPath.pattern = contentPath.glob
|
||||
? `${contentPath.base}/${contentPath.glob}`
|
||||
: contentPath.base
|
||||
|
||||
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern
|
||||
|
||||
// This is required for Windows support to properly pick up Glob paths.
|
||||
// Afaik, this technically shouldn't be needed but there's probably
|
||||
// some internal, direct path matching with a normalized path in
|
||||
// a package which can't handle mixed directory separators
|
||||
contentPath.pattern = normalizePath(contentPath.pattern)
|
||||
let base = normalizePath(contentPath.base)
|
||||
|
||||
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
||||
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
||||
base = fastGlob.escapePath(base)
|
||||
|
||||
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base
|
||||
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern
|
||||
|
||||
return contentPath
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue