Browse Source

Merge 9f35f59f61 into d96bbaf42c

pull/7440/merge
TheMet4lGod 3 weeks ago
committed by GitHub
parent
commit
dbb5b21db6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions
  1. 4
      client/components/common/page-selector.vue
  2. 5
      server/helpers/page.js

4
client/components/common/page-selector.vue

@ -103,8 +103,6 @@
import _ from 'lodash' import _ from 'lodash'
import gql from 'graphql-tag' import gql from 'graphql-tag'
const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
/* global siteLangs, siteConfig */ /* global siteLangs, siteConfig */
export default { export default {
@ -192,8 +190,6 @@ export default {
const firstSection = _.head(this.currentPath.split('/')) const firstSection = _.head(this.currentPath.split('/'))
if (firstSection.length <= 1) { if (firstSection.length <= 1) {
return false return false
} else if (localeSegmentRegex.test(firstSection)) {
return false
} else if ( } else if (
_.some(['login', 'logout', 'register', 'verify', 'favicons', 'fonts', 'img', 'js', 'svg'], p => { _.some(['login', 'logout', 'register', 'verify', 'favicons', 'fonts', 'img', 'js', 'svg'], p => {
return p === firstSection return p === firstSection

5
server/helpers/page.js

@ -3,8 +3,9 @@ const _ = require('lodash')
const crypto = require('crypto') const crypto = require('crypto')
const path = require('path') 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 // eslint-disable-next-line no-control-regex
const unsafeCharsRegex = /[\x00-\x1f\x80-\x9f\\"|<>:*?]/ const unsafeCharsRegex = /[\x00-\x1f\x80-\x9f\\"|<>:*?]/

Loading…
Cancel
Save