mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
clean up relative path checking
This commit is contained in:
parent
64ea22d259
commit
43b0429c28
1 changed files with 6 additions and 7 deletions
|
@ -98,13 +98,12 @@ module.exports = ResourceStateManager = {
|
||||||
checkResourceFiles(resources, allFiles, basePath, callback) {
|
checkResourceFiles(resources, allFiles, basePath, callback) {
|
||||||
// check the paths are all relative to current directory
|
// check the paths are all relative to current directory
|
||||||
let file
|
let file
|
||||||
for (file of resources || []) {
|
const containsRelativePath = (resource) => {
|
||||||
if (file && file.path) {
|
const dirs = resource.path.split('/')
|
||||||
const dirs = file.path.split('/')
|
return dirs.indexOf('..') !== -1
|
||||||
if (dirs.indexOf('..') !== -1) {
|
}
|
||||||
return callback(new Error('relative path in resource file list'))
|
if (resources.some(containsRelativePath)) {
|
||||||
}
|
return callback(new Error('relative path in resource file list'))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// check if any of the input files are not present in list of files
|
// check if any of the input files are not present in list of files
|
||||||
const seenFile = {}
|
const seenFile = {}
|
||||||
|
|
Loading…
Reference in a new issue