Skip to content

Commit

Permalink
fix(strict-mode): make regexes more rigid
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Mar 24, 2017
1 parent 4acad30 commit 122a32c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const Transform = require('stream').Transform

const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512']

const BASE64_REGEX = /[a-z0-9+/]+(?:=?=?)/i
const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i
const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/
const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/]+(?:=?=?))([?\x21-\x7E]*)$/
const VCHAR_REGEX = /[\x21-\x7E]+/
const VCHAR_REGEX = /^[\x21-\x7E]+$/

class IntegrityMetadata {
constructor (metadata, opts) {
Expand Down Expand Up @@ -75,7 +75,7 @@ class Integrity {
const other = typeof integrity === 'string'
? integrity
: stringify(integrity, opts)
return parse(`${this.toString()} ${other}`, opts)
return parse(`${this.toString(opts)} ${other}`, opts)
}
}

Expand Down

0 comments on commit 122a32c

Please sign in to comment.