MCPcopy Create free account
hub / github.com/VemtoOrg/vemto2 / folderIsRestrict

Method folderIsRestrict

src/main/base/FileSystem.ts:170–189  ·  view source on GitHub ↗
(folderPath: string)

Source from the content-addressed store, hash-verified

168 }
169
170 folderIsRestrict(folderPath: string) {
171 const absolutePath = path.resolve(folderPath)
172
173 // if folder is not a Laravel project, it is restricted
174 if(!this.isLaravelProject(folderPath)) {
175 console.log("Folder is not a Laravel project: ", folderPath, absolutePath)
176 return true
177 }
178
179 console.log("Checking if folder is valid: ", folderPath, absolutePath)
180
181 const invalidPaths = [
182 "/", "C:\\", "/bin", "/etc", "/usr", "C:\\Windows", "C:\\Program Files"
183 ].map(p => path.resolve(p))
184
185 // Check if the projectPath is exactly one of the invalid paths or a subdirectory of them
186 return !absolutePath || invalidPaths.some(
187 invalidPath => absolutePath === invalidPath || absolutePath.startsWith(`${invalidPath}${path.sep}`)
188 )
189 }
190
191 isLaravelProject(folderPath: string) {
192 return this.fileExists(path.join(folderPath, 'artisan'))

Callers 3

deleteFolderMethod · 0.95
HandleIpcMessagesFunction · 0.80
projectPathIsInvalidFunction · 0.80

Calls 2

isLaravelProjectMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected