Merge pull request #125 from upsided/master
Allow unicode characters in claim names.
This commit is contained in:
commit
efaacdd26b
2 changed files with 8 additions and 8 deletions
8
dist/bundle.es.js
vendored
8
dist/bundle.es.js
vendored
|
@ -831,7 +831,8 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|||
const channelNameMinLength = 1;
|
||||
const claimIdMaxLength = 40;
|
||||
|
||||
const regexInvalidURI = /[^A-Za-z0-9-]/g;
|
||||
// see https://spec.lbry.com/#urls
|
||||
const regexInvalidURI = exports.regexInvalidURI = /[=&#:$@%?\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/gu;
|
||||
const regexAddress = /^(b|r)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/;
|
||||
|
||||
/**
|
||||
|
@ -999,9 +1000,8 @@ function isURIValid(URI) {
|
|||
return parts && parts.claimName;
|
||||
}
|
||||
|
||||
function isNameValid(claimName, checkCase = true) {
|
||||
const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i');
|
||||
return regexp.test(claimName);
|
||||
function isNameValid(claimName) {
|
||||
return !regexInvalidURI.test(claimName);
|
||||
}
|
||||
|
||||
function isURIClaimable(URI) {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const channelNameMinLength = 1;
|
||||
const claimIdMaxLength = 40;
|
||||
|
||||
export const regexInvalidURI = /[^A-Za-z0-9-]/g;
|
||||
// see https://spec.lbry.com/#urls
|
||||
export const regexInvalidURI = (exports.regexInvalidURI = /[=&#:$@%?\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/gu);
|
||||
export const regexAddress = /^(b|r)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/;
|
||||
|
||||
/**
|
||||
|
@ -200,9 +201,8 @@ export function isURIValid(URI) {
|
|||
return parts && parts.claimName;
|
||||
}
|
||||
|
||||
export function isNameValid(claimName, checkCase = true) {
|
||||
const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i');
|
||||
return regexp.test(claimName);
|
||||
export function isNameValid(claimName) {
|
||||
return !regexInvalidURI.test(claimName);
|
||||
}
|
||||
|
||||
export function isURIClaimable(URI) {
|
||||
|
|
Loading…
Reference in a new issue