-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #SB-812 fix: Changed share url for unlisted content
- Loading branch information
anuj
committed
Nov 22, 2017
1 parent
95cfc22
commit 04587a2
Showing
3 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
let publicUri = '/public/#!' | ||
|
||
module.exports = function (app) { | ||
app.all('/content/*', function (req, res) { | ||
app.all('/content/:id', function (req, res) { | ||
let redirectUrl = publicUri + req.path | ||
res.redirect(redirectUrl) | ||
}) | ||
|
||
app.all('/course/*', function (req, res) { | ||
app.all('/course/:id', function (req, res) { | ||
let redirectUrl = publicUri + req.path | ||
res.redirect(redirectUrl) | ||
}) | ||
|
||
app.all('/unlisted/:hash', function (req, res) { | ||
let hash = req.params.hash | ||
let uri = Buffer.from(hash, 'base64').toString() | ||
let redirectUrl = publicUri + '/' + uri + '/unlisted' | ||
if (redirectUrl.indexOf('collection') > -1) { | ||
redirectUrl = redirectUrl.replace('collection', 'content') | ||
redirectUrl = redirectUrl + '/' | ||
} | ||
res.redirect(redirectUrl) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters