Skip to content

Commit 32ef086

Browse files
committed
#172 fixes bug with retrieving publications
1 parent 9e5e096 commit 32ef086

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

grails-app/controllers/au/org/ala/profile/hub/ProfileController.groovy

+3-3
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,12 @@ class ProfileController extends BaseController {
484484
if (!pubId) {
485485
badRequest "Publication Id must be provided";
486486
} else {
487-
def pubJson = profileService.getPublications(pubId)?.resp;
487+
def pubJson = profileService.getPublications(pubId)
488488
if (!pubJson) {
489489
notFound()
490490
} else {
491-
boolean latest = params.isOpusReviewer || params.isOpusEditor || params.isOpusAdmin;
492-
def profile = profileService.getProfile(pubJson.opusId, pubJson.profileId, latest);
491+
boolean latest = params.isOpusReviewer || params.isOpusEditor || params.isOpusAdmin
492+
def profile = profileService.getProfile(pubJson.opusId, pubJson.profileId, latest)
493493

494494
if (!profile) {
495495
notFound()

grails-app/services/au/org/ala/profile/hub/ProfileService.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class ProfileService {
9595
}
9696

9797
def getPublications(String pubId) {
98-
webService.get("${grailsApplication.config.profile.service.url}/publication/${enc(pubId)}")
98+
webService.get("${grailsApplication.config.profile.service.url}/publication/${enc(pubId)}")?.resp
9999
}
100100

101101
def getProfile(String opusId, String profileId, boolean latest = false) {

grails-app/services/au/org/ala/profile/hub/WebService.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class WebService {
141141
} else if (data != null) {
142142
contentType = ContentType.APPLICATION_JSON
143143
body = data
144+
} else {
145+
contentType = ContentType.APPLICATION_JSON
144146
}
145147

146148
response.success = { resp, json ->

0 commit comments

Comments
 (0)