mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-22 06:49:26 +01:00
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.slice(0, 4) === 'www.') {
|
||||
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()
|
||||
|
@ -17,7 +17,7 @@ module.exports = function(tools) {
|
||||
* https://teddit.net/vids/f3lcdk4ydcl51.mp4
|
||||
*/
|
||||
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) => {
|
||||
if(!invalid_urls.includes(url)) {
|
||||
(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user