Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,9 @@ class WorkflowResource extends LazyLogging {
.where(WORKFLOW.WID.eq(wid))
.and(WORKFLOW.IS_PUBLIC.isTrue)
.fetchOne()
if (workflow == null) {
throw new NotFoundException(s"Public workflow with id $wid not found")
}
// Name and description come from the public copy for the same reason as the content: a pin has
// to hold everything on show.
val publicCopy = WorkflowPublishService.publicCopyOf(workflow.into(classOf[Workflow]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,16 @@ class WorkflowResourceSpec
assertThrows[ForbiddenException](workflowResource.makePublic(wid, sessionUser2))
}

"WorkflowResource.retrievePublicWorkflow" should "throw NotFoundException for a private workflow" in {
val wid = seedWorkflow(sessionUser1, "public-private-wf").workflow.getWid
assertThrows[NotFoundException](workflowResource.retrievePublicWorkflow(wid))
}

it should "throw NotFoundException for a wid that does not exist" in {
val wid = seedWorkflow(sessionUser1, "public-missing-wf").workflow.getWid
assertThrows[NotFoundException](workflowResource.retrievePublicWorkflow(wid + 100000))
}

"WorkflowResource.duplicateWorkflow" should "create a distinct copy owned by the user" in {
// duplicateWorkflow reassigns operator ids, so the content must have an operators array.
val wid = seedWorkflow(
Expand Down
Loading