diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 72d93c5..6962678 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1473,7 +1473,7 @@ const channelNameMinLength = 1; const claimIdMaxLength = 40; // see https://spec.lbry.com/#urls -const regexInvalidURI = /[ =&#:$@%?;/\\"<>%\{\}|^~[\]`\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/u; +const regexInvalidURI = /[ =&#:$@%?;/\\"<>%{}|^~[\]`\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/u; const regexAddress = /^(b|r)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/; const regexPartProtocol = '^((?:lbry://)?)'; const regexPartStreamOrChannelName = '([^:$#/]*)'; @@ -1481,6 +1481,11 @@ const regexPartModifierSeparator = '([:$#]?)([^/]*)'; const queryStringBreaker = '^([\\S]+)([?][\\S]*)'; const separateQuerystring = new RegExp(queryStringBreaker); +const MOD_SEQUENCE_SEPARATOR = '*'; +const MOD_CLAIM_ID_SEPARATOR_OLD = '#'; +const MOD_CLAIM_ID_SEPARATOR = ':'; +const MOD_BID_POSITION_SEPARATOR = '$'; + /** * Parses a LBRY name into its component parts. Throws errors with user-friendly * messages for invalid names. @@ -1582,11 +1587,11 @@ function parseURIModifier(modSeperator, modValue) { throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); } - if (modSeperator === '#') { + if (modSeperator === MOD_CLAIM_ID_SEPARATOR || MOD_CLAIM_ID_SEPARATOR_OLD) { claimId = modValue; - } else if (modSeperator === ':') { + } else if (modSeperator === MOD_SEQUENCE_SEPARATOR) { claimSequence = modValue; - } else if (modSeperator === '$') { + } else if (modSeperator === MOD_BID_POSITION_SEPARATOR) { bidPosition = modValue; } } diff --git a/src/lbryURI.js b/src/lbryURI.js index ee91388..2ec1e6f 100644 --- a/src/lbryURI.js +++ b/src/lbryURI.js @@ -4,7 +4,7 @@ const channelNameMinLength = 1; const claimIdMaxLength = 40; // see https://spec.lbry.com/#urls -export const regexInvalidURI = /[ =&#:$@%?;/\\"<>%\{\}|^~[\]`\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/u; +export const regexInvalidURI = /[ =&#:$@%?;/\\"<>%{}|^~[\]`\u{0000}-\u{0008}\u{000b}-\u{000c}\u{000e}-\u{001F}\u{D800}-\u{DFFF}\u{FFFE}-\u{FFFF}]/u; export const regexAddress = /^(b|r)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/; const regexPartProtocol = '^((?:lbry://)?)'; const regexPartStreamOrChannelName = '([^:$#/]*)'; @@ -12,6 +12,11 @@ const regexPartModifierSeparator = '([:$#]?)([^/]*)'; const queryStringBreaker = '^([\\S]+)([?][\\S]*)'; const separateQuerystring = new RegExp(queryStringBreaker); +const MOD_SEQUENCE_SEPARATOR = '*'; +const MOD_CLAIM_ID_SEPARATOR_OLD = '#'; +const MOD_CLAIM_ID_SEPARATOR = ':'; +const MOD_BID_POSITION_SEPARATOR = '$'; + /** * Parses a LBRY name into its component parts. Throws errors with user-friendly * messages for invalid names. @@ -144,11 +149,11 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) { throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator })); } - if (modSeperator === '#') { + if (modSeperator === MOD_CLAIM_ID_SEPARATOR || MOD_CLAIM_ID_SEPARATOR_OLD) { claimId = modValue; - } else if (modSeperator === ':') { + } else if (modSeperator === MOD_SEQUENCE_SEPARATOR) { claimSequence = modValue; - } else if (modSeperator === '$') { + } else if (modSeperator === MOD_BID_POSITION_SEPARATOR) { bidPosition = modValue; } }