mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #18223 from overleaf/jpa-lazy-init-matcher
[web] initialize matcher for ignored file paths lazily GitOrigin-RevId: ed04b286e188ad73e3090822965b19ccf2e7d2b4
This commit is contained in:
parent
3300811d3a
commit
3cb4190ef0
1 changed files with 8 additions and 4 deletions
|
@ -1,11 +1,15 @@
|
||||||
import { Minimatch } from 'minimatch'
|
import { Minimatch } from 'minimatch'
|
||||||
|
|
||||||
const fileIgnoreMatcher = new Minimatch(
|
let fileIgnoreMatcher: Minimatch
|
||||||
window.ExposedSettings.fileIgnorePattern,
|
|
||||||
{ nocase: true, dot: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
export const isAcceptableFile = (name?: string, relativePath?: string) => {
|
export const isAcceptableFile = (name?: string, relativePath?: string) => {
|
||||||
|
if (!fileIgnoreMatcher) {
|
||||||
|
fileIgnoreMatcher = new Minimatch(
|
||||||
|
window.ExposedSettings.fileIgnorePattern,
|
||||||
|
{ nocase: true, dot: true }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
// the file must have a name, of course
|
// the file must have a name, of course
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue