-
Bug
-
Resolution: Duplicate
-
Normal
-
None
-
None
-
None
Found while testing searching in user metadata, in the search result table, the links to datasets or files were generated by the JavaScript explicitly with code using window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/datasets/" + ...
This worked fine if Clowder's path has no prefix, such as "http://host1", however, if the web root has some prefix, such as http://clowder.ncsa.illinois.edu/medici/, then the link does not contain the "/medici/" part. Clicking it leads to "page not found", or gets redirected to a generic page.
In /public/javascripts, searchUserMetadata.js and collectionDatasetsList.js have this issue. Rui had a fix for the former one, in https://opensource.ncsa.illinois.edu/stash/projects/MMDB/repos/medici-play/commits/6075ac374c0d7ab27db2444baa06fd009e800e97, but that's in a branch, not in "develop" yet.
A tested solution is:
1) add a JavaScript global variable "WEB_ROOT" in app/views/main.scala.html, assign it the routes to the Clowder root page:
window["WEB_ROOT"] = "@routes.Application.index";
|
2) use it in the JavaScript where such URL links are generated to replace the "window.location.protocol + ..." parts, such as:
< fileThumbnail = "<img src='" + window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '') + "/fileThumbnail/" + respJSON[i].thumbnail + "/blob' "
|
> fileThumbnail = "<img src='" + window["WEB_ROOT"] + "fileThumbnail/" + respJSON[i].thumbnail + "/blob' "
|