fix an issue when url is undefined and post won't load
This commit is contained in:
parent
972865d50f
commit
30a0b24258
2
app.js
2
app.js
|
@ -82,7 +82,7 @@ if(redirect_www) {
|
||||||
if(req.headers.host) {
|
if(req.headers.host) {
|
||||||
if(req.headers.host.slice(0, 4) === 'www.') {
|
if(req.headers.host.slice(0, 4) === 'www.') {
|
||||||
let newhost = req.headers.host.slice(4)
|
let newhost = req.headers.host.slice(4)
|
||||||
return res.redirect(301, req.protocol + '://' + newhost + req.originalUrl)
|
return res.redirect(301, `${req.protocol}://${newhost}${req.originalUrl}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = function(tools) {
|
||||||
* https://teddit.net/vids/f3lcdk4ydcl51.mp4
|
* https://teddit.net/vids/f3lcdk4ydcl51.mp4
|
||||||
*/
|
*/
|
||||||
let valid_video_extensions = ['mp4', 'webm', 'ogg']
|
let valid_video_extensions = ['mp4', 'webm', 'ogg']
|
||||||
let invalid_urls = ['self', 'default', 'nsfw', 'image', 'spoiler']
|
let invalid_urls = ['self', 'default', 'nsfw', 'image', 'spoiler', 'undefined', undefined, null, '']
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(!invalid_urls.includes(url)) {
|
if(!invalid_urls.includes(url)) {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
Loading…
Reference in New Issue