Skip to content

Commit 638d782

Browse files
committed
fix missing prefix to untrail (fixes #62)
1 parent 731b95d commit 638d782

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/controllers/Application.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Application @Inject() (files: FileService, collections: CollectionService,
3131
* @param path the path minus the slash
3232
* @return moved permanently to path without /
3333
*/
34-
def untrail(path: String) = Action {
35-
MovedPermanently("/" + path)
34+
def untrail(path: String) = Action { implicit request =>
35+
MovedPermanently(s"${Utils.baseUrl(request, false)}/${path}")
3636
}
3737

3838
def swaggerUI = Action { implicit request =>

app/controllers/Utils.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ object Utils {
1414
* Return base url given a request. This will add http or https to the front, for example
1515
* https://localhost:9443 will be returned if it is using https.
1616
*/
17-
def baseUrl(request: Request[Any]) = {
18-
routes.Files.list().absoluteURL(https(request))(request).replace("/files", "")
17+
def baseUrl(request: Request[Any], absolute: Boolean = true) = {
18+
if (absolute) {
19+
routes.Files.list().absoluteURL(https(request))(request).replace("/files", "")
20+
} else {
21+
routes.Files.list().url.replace("/files", "")
22+
}
1923
}
2024

2125
/**

0 commit comments

Comments
 (0)