Fix validation of project-output-file, no build_id for imported v1 projects

This commit is contained in:
Shane Kilkelly 2018-06-25 12:27:56 +01:00
parent f6424ada40
commit 04be842b30
2 changed files with 12 additions and 7 deletions

View file

@ -93,11 +93,17 @@ module.exports = ProjectOutputFileAgent = {
_getSourceProject: LinkedFilesHandler.getSourceProject
_validate: (data) ->
return (
(data.source_project_id? || data.v1_source_doc_id?) &&
data.source_output_file_path? &&
data.build_id?
)
if data.v1_source_doc_id?
(
data.v1_source_doc_id? &&
data.source_output_file_path?
)
else
(
data.source_project_id? &&
data.source_output_file_path? &&
data.build_id?
)
_checkAuth: (project_id, data, current_user_id, callback = (err, allowed)->) ->
callback = _.once(callback)

View file

@ -428,8 +428,7 @@ describe "LinkedFiles", ->
linkedFileData: {
provider: "project_output_file",
v1_source_doc_id: 9999999, # We won't find this id in the database
source_output_file_path: "project.pdf",
build_id: '123'
source_output_file_path: "project.pdf"
},
_id: "abcdef",
rev: 0,