Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions client/components/common/page-selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@
import _ from 'lodash'
import gql from 'graphql-tag'

const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i

/* global siteLangs, siteConfig */

export default {
Expand Down Expand Up @@ -192,8 +190,6 @@ export default {
const firstSection = _.head(this.currentPath.split('/'))
if (firstSection.length <= 1) {
return false
} else if (localeSegmentRegex.test(firstSection)) {
return false
} else if (
_.some(['login', 'logout', 'register', 'verify', 'favicons', 'fonts', 'img', 'js', 'svg'], p => {
return p === firstSection
Expand Down
5 changes: 3 additions & 2 deletions server/helpers/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ const _ = require('lodash')
const crypto = require('crypto')
const path = require('path')

const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
const localeFolderRegex = /^([a-z]{2}(?:-[a-z]{2})?\/)?(.*)/i
// exclude Regex matches based on ISO 639-1 individual living languages
const localeSegmentRegex = /^(?!a[^abfmnsv])(?!b[^ameniosrg])(?!c[^ashevoy])(?!d[^aevz])(?!e[^lnue])(?!f[^ojiry])(?!g[^dalvu])(?!h[^taezioruy])(?!i[^gsidt])(?!j[^av])(?!k[^lnsakmiyoj])(?!l[^ointbug])(?!m[^khlirty])(?!n[^avrdglnby])(?!o[^cs])(?!p[^alt])(?!r[^monu])(?!s[^giklemndotrsuv])(?!t[^yateglhionskrw])(?!u[^gkr])(?!v[^ei])(?!w[^ao])(?!x[^h])(?!y[^o])(?!z[^u])[A-Z]{2}(-[A-Z]{2})?$/i
const localeFolderRegex = /^((?!a[^abfmnsv])(?!b[^ameniosrg])(?!c[^ashevoy])(?!d[^aevz])(?!e[^lnue])(?!f[^ojiry])(?!g[^dalvu])(?!h[^taezioruy])(?!i[^gsidt])(?!j[^av])(?!k[^lnsakmiyoj])(?!l[^ointbug])(?!m[^khlirty])(?!n[^avrdglnby])(?!o[^cs])(?!p[^alt])(?!r[^monu])(?!s[^giklemndotrsuv])(?!t[^yateglhionskrw])(?!u[^gkr])(?!v[^ei])(?!w[^ao])(?!x[^h])(?!y[^o])(?!z[^u])[a-z]{2}(?:-[a-z]{2})?\/)?(.*)/i
// eslint-disable-next-line no-control-regex
const unsafeCharsRegex = /[\x00-\x1f\x80-\x9f\\"|<>:*?]/

Expand Down