Skip to content
Permalink
Browse files

Disable Korean character conversion in post slugs

  • Loading branch information
yhbyun committed May 5, 2019
1 parent 9f9dde3 commit e8e33ca3c26b53f38bc9a15f9b8f23e94665625a
@@ -80,7 +80,7 @@ validator.extend('isEmptyOrURL', function isEmptyOrURL(str) {
});

validator.extend('isSlug', function isSlug(str) {
return validator.matches(str, /^[a-z0-9\-_]+$/);
return validator.matches(str, /^[a-z0-9\-_ㄱ-ㅎㅏ-ㅣ가-힣]+$/);
});

/**
@@ -12,7 +12,7 @@ module.exports.safe = function safe(string, options) {
string = string.replace(/£/g, '-');

// Remove non ascii characters
string = unidecode(string);
// string = unidecode(string);

// Replace URL reserved chars: `@:/?#[]!$&()*+,;=` as well as `\%<>|^~£"{}` and \`
string = string.replace(/(\s|\.|@|:|\/|\?|#|\[|\]|!|\$|&|\(|\)|\*|\+|,|;|=|\\|%|<|>|\||\^|~|"|\{|\}|`||)/g, '-')
@@ -74,7 +74,7 @@ module.exports = function entryController(req, res, next) {
* @TODO:
* Simplify if we drop v0.1.
*/
if (urlService.utils.absoluteToRelative(entry.url, {withoutSubdirectory: true}) !== req.path) {
if (encodeURI(urlService.utils.absoluteToRelative(entry.url, {withoutSubdirectory: true})) !== req.path) {
debug('redirect');

return urlService.utils.redirect301(res, url.format({

0 comments on commit e8e33ca

Please sign in to comment.
You can’t perform that action at this time.