mkdir p changed so it does not get entire project, now without doc lines

This commit is contained in:
Henry Oswald 2014-11-27 12:07:49 +00:00
parent 63deb0a508
commit 0bc76b6d92
2 changed files with 5 additions and 4 deletions

View file

@ -195,13 +195,13 @@ module.exports = ProjectEntityHandler =
tpdsUpdateSender.addFile {project_id:project._id, file_id:fileRef._id, path:result.path.fileSystem, rev:fileRef.rev, project_name:project.name}, (error) ->
callback(error, fileRef, folder_id)
mkdirp: (project_or_id, path, callback = (err, newlyCreatedFolders, lastFolderInPath)->)->
mkdirp: (project_id, path, callback = (err, newlyCreatedFolders, lastFolderInPath)->)->
self = @
folders = path.split('/')
folders = _.select folders, (folder)->
return folder.length != 0
Project.getProject project_or_id, "", (err, project)=>
ProjectGetter.getProjectWithoutDocLines project_id, (err, project)=>
if path == '/'
logger.log project_id: project._id, "mkdir is only trying to make path of / so sending back root folder"
return callback(null, [], project.rootFolder[0])
@ -214,10 +214,10 @@ module.exports = ProjectEntityHandler =
if parentFolder?
parentFolder_id = parentFolder._id
builtUpPath = "#{builtUpPath}/#{folderName}"
projectLocator.findElementByPath project_or_id, builtUpPath, (err, foundFolder)=>
projectLocator.findElementByPath project_id, builtUpPath, (err, foundFolder)=>
if !foundFolder?
logger.log path:path, project_id:project._id, folderName:folderName, "making folder from mkdirp"
@addFolder project_or_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)->
@addFolder project_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)->
newFolder.parentFolder_id = parentFolder_id
previousFolders.push newFolder
callback null, previousFolders

View file

@ -77,6 +77,7 @@ describe 'ProjectEntityHandler', ->
@parentFolder_id = "1jnjknjk"
@newFolder = {_id:"newFolder_id_here"}
@lastFolder = {_id:"123das", folders:[]}
@ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, @project)
@projectLocator.findElementByPath = (project_id, path, cb)=>
@parentFolder = {_id:"parentFolder_id_here"}
lastFolder = path.substring(path.lastIndexOf("/"))