mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 01:26:16 +01:00
closes #4717
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var nconf = require('nconf'),
|
var nconf = require('nconf');
|
||||||
url = require('url');
|
var url = require('url');
|
||||||
|
var winston = require('winston');
|
||||||
|
|
||||||
var cache = require('./cache');
|
var cache = require('./cache');
|
||||||
var plugins = require('../plugins');
|
var plugins = require('../plugins');
|
||||||
@@ -52,8 +53,8 @@ module.exports = function(Posts) {
|
|||||||
|
|
||||||
while ((current = urlRegex.exec(content)) !== null) {
|
while ((current = urlRegex.exec(content)) !== null) {
|
||||||
if (current[1]) {
|
if (current[1]) {
|
||||||
|
try {
|
||||||
parsed = url.parse(current[1]);
|
parsed = url.parse(current[1]);
|
||||||
|
|
||||||
if (!parsed.protocol) {
|
if (!parsed.protocol) {
|
||||||
if (current[1].startsWith('/')) {
|
if (current[1].startsWith('/')) {
|
||||||
// Internal link
|
// Internal link
|
||||||
@@ -65,6 +66,9 @@ module.exports = function(Posts) {
|
|||||||
|
|
||||||
content = content.slice(0, current.index + 6) + absolute + content.slice(current.index + 6 + current[1].length);
|
content = content.slice(0, current.index + 6) + absolute + content.slice(current.index + 6 + current[1].length);
|
||||||
}
|
}
|
||||||
|
} catch(err) {
|
||||||
|
winston.verbose(err.messsage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user