mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #9696 from overleaf/em-fix-dropbox-top-level
Fix Dropbox metadata collection for top level folders GitOrigin-RevId: a6262968f206cfd3459f2bae628f156d22bccd91
This commit is contained in:
parent
a6307d8497
commit
33d9f08599
2 changed files with 21 additions and 1 deletions
|
@ -103,7 +103,7 @@ async function updateFolder(req, res) {
|
|||
entityId: metadata.folderId.toString(),
|
||||
projectId: metadata.projectId.toString(),
|
||||
path: metadata.path,
|
||||
folderId: metadata.parentFolderId.toString(),
|
||||
folderId: metadata.parentFolderId?.toString() || null,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,26 @@ describe('TpdsController', function () {
|
|||
this.TpdsController.updateFolder(this.req, this.res)
|
||||
})
|
||||
|
||||
it('supports top level folders', function (done) {
|
||||
const metadata = {
|
||||
folderId: ObjectId(),
|
||||
projectId: ObjectId(),
|
||||
path: '/',
|
||||
parentFolderId: null,
|
||||
}
|
||||
this.TpdsUpdateHandler.promises.createFolder.resolves(metadata)
|
||||
this.res.json.callsFake(body => {
|
||||
expect(body).to.deep.equal({
|
||||
entityId: metadata.folderId.toString(),
|
||||
projectId: metadata.projectId.toString(),
|
||||
path: metadata.path,
|
||||
folderId: null,
|
||||
})
|
||||
done()
|
||||
})
|
||||
this.TpdsController.updateFolder(this.req, this.res)
|
||||
})
|
||||
|
||||
it("returns a 409 if the folder couldn't be created", function (done) {
|
||||
this.TpdsUpdateHandler.promises.createFolder.resolves(null)
|
||||
this.HttpErrorHandler.conflict.callsFake((req, res) => {
|
||||
|
|
Loading…
Reference in a new issue