mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #8033 from overleaf/em-find-files-without-ids
Script to find files and docs without ids in projects GitOrigin-RevId: 5c29d92748a01a1e48288479b25560127aafd397
This commit is contained in:
@@ -35,6 +35,10 @@ function processProject(project) {
|
|||||||
function findBadPaths(folder) {
|
function findBadPaths(folder) {
|
||||||
const result = []
|
const result = []
|
||||||
|
|
||||||
|
if (!folder._id) {
|
||||||
|
result.push('_id')
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof folder.name !== 'string' || !folder.name) {
|
if (typeof folder.name !== 'string' || !folder.name) {
|
||||||
result.push('name')
|
result.push('name')
|
||||||
}
|
}
|
||||||
@@ -62,9 +66,13 @@ function findBadPaths(folder) {
|
|||||||
result.push(`docs.${i}`)
|
result.push(`docs.${i}`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if (!doc._id) {
|
||||||
|
result.push(`docs.${i}._id`)
|
||||||
|
// no need to check further: this doc can be deleted
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (typeof doc.name !== 'string' || !doc.name) {
|
if (typeof doc.name !== 'string' || !doc.name) {
|
||||||
result.push(`docs.${i}.name`)
|
result.push(`docs.${i}.name`)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -79,9 +87,13 @@ function findBadPaths(folder) {
|
|||||||
result.push(`fileRefs.${i}`)
|
result.push(`fileRefs.${i}`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if (!file._id) {
|
||||||
|
result.push(`fileRefs.${i}._id`)
|
||||||
|
// no need to check further: this file can be deleted
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (typeof file.name !== 'string' || !file.name) {
|
if (typeof file.name !== 'string' || !file.name) {
|
||||||
result.push(`fileRefs.${i}.name`)
|
result.push(`fileRefs.${i}.name`)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user