Merge pull request #10888 from overleaf/bg-case-sensitive-delete

Make dropbox deletes case-sensitive

GitOrigin-RevId: 090112ce82e38f15079053952db4b0a1544e8300
This commit is contained in:
Brian Gough 2022-12-14 11:28:29 +00:00 committed by Copybot
parent e433acfc49
commit 2cc2da18a5
3 changed files with 19 additions and 2 deletions

View file

@ -1163,7 +1163,7 @@ const ProjectEntityUpdateHandler = {
deleteEntityWithPath: wrapWithLock( deleteEntityWithPath: wrapWithLock(
(projectId, path, userId, source, callback) => (projectId, path, userId, source, callback) =>
ProjectLocator.findElementByPath( ProjectLocator.findElementByPath(
{ project_id: projectId, path }, { project_id: projectId, path, exactCaseMatch: true },
(err, element, type) => { (err, element, type) => {
if (err != null) { if (err != null) {
return callback(err) return callback(err)

View file

@ -1632,7 +1632,11 @@ describe('ProjectEntityUpdateHandler', function () {
it('finds the entity', function () { it('finds the entity', function () {
this.ProjectLocator.findElementByPath this.ProjectLocator.findElementByPath
.calledWith({ project_id: projectId, path: this.path }) .calledWith({
project_id: projectId,
path: this.path,
exactCaseMatch: true,
})
.should.equal(true) .should.equal(true)
}) })

View file

@ -400,6 +400,19 @@ describe('ProjectLocator', function () {
) )
}) })
it('should not return elements with a case-insensitive match when exactCaseMatch is true', function (done) {
const path = `${subFolder.name.toUpperCase()}/${secondSubFolder.name.toUpperCase()}/${subSubFile.name.toUpperCase()}`
this.locator.findElementByPath(
{ project, path, exactCaseMatch: true },
(err, element, type, folder) => {
err.should.not.equal(undefined)
expect(element).to.be.undefined
expect(type).to.be.undefined
done()
}
)
})
it('should take a file path and return the element for a nested folder', function (done) { it('should take a file path and return the element for a nested folder', function (done) {
const path = `${subFolder.name}/${secondSubFolder.name}` const path = `${subFolder.name}/${secondSubFolder.name}`
this.locator.findElementByPath( this.locator.findElementByPath(