fix blob reference when SSRing

main
Mike Fix 5 years ago
parent 6871a4db05
commit 0666d5b975

@ -21,9 +21,13 @@ const MAX_PAYLOAD_SIZE = 5e6 // bytes
function verifyPayloadSize(str) {
if (typeof str !== 'string') return true
if (typeof window !== 'undefined') {
return new Blob([str]).size < MAX_PAYLOAD_SIZE
}
return Buffer.byteLength(str, 'utf8')
}
const CopyEmbed = withRouter(({ router: { asPath }, mapper, title, margin }) => {
const text = React.useMemo(() => mapper(asPath), [mapper, asPath])
const { onClick, copied } = useCopyTextHandler(text)

Loading…
Cancel
Save