How to use @braintree/sanitize-url - 10 common examples

To help you get started, we’ve selected a few @braintree/sanitize-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mermaid-js / mermaid / src / diagrams / flowchart / flowDb.js View on Github external
ids.split(',').forEach(function(_id) {
    let id = _id;
    if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
    if (typeof vertices[id] !== 'undefined') {
      if (config.securityLevel !== 'loose') {
        vertices[id].link = sanitizeUrl(linkStr); // .replace(/javascript:.*/g, '')
      } else {
        vertices[id].link = linkStr;
      }
    }
  });
  setTooltip(ids, tooltip);
github SAPConversationalAI / Webchat / src / components / Message / List.js View on Github external
const ListElement = ({ title, subtitle, imageUrl, buttons, sendMessage }) => {
  const titleMaxLength = 25
  const subTitleMaxLength = 50
  const buttonTitleMaxLength = 20

  const button = propOr(null, 0, buttons)

  return (
    <div>
      {imageUrl
        &amp;&amp; sanitizeUrl(imageUrl) !== 'about:blank' &amp;&amp; (
        <img src="{imageUrl}">
      )}

      <div>
        <p>{truncate(title, titleMaxLength)}</p>
        <p>{truncate(subtitle, subTitleMaxLength)}</p>

        {button
          &amp;&amp; (button.type === 'web_url' ? (
            sanitizeUrl(button.value) !== 'about:blank' &amp;&amp; (
              <a rel="noopener noreferrer" href="{button.value}"></a></div></div>
github SAPConversationalAI / Webchat / src / components / Message / List.js View on Github external
const button = propOr(null, 0, buttons)

  return (
    <div>
      {imageUrl
        &amp;&amp; sanitizeUrl(imageUrl) !== 'about:blank' &amp;&amp; (
        <img src="{imageUrl}">
      )}

      <div>
        <p>{truncate(title, titleMaxLength)}</p>
        <p>{truncate(subtitle, subTitleMaxLength)}</p>

        {button
          &amp;&amp; (button.type === 'web_url' ? (
            sanitizeUrl(button.value) !== 'about:blank' &amp;&amp; (
              <a rel="noopener noreferrer" href="{button.value}">
                {truncate(button.title, buttonTitleMaxLength)}
              </a>
            )
          ) : (
            <div> sendMessage({ type: 'text', content: button.value })}
            &gt;
              {truncate(button.title, buttonTitleMaxLength)}
            </div></div></div>
github italia / developers.italia.it / swagger / components / Hero.js View on Github external
<div>{`${channel}`}</div>
                  <div>{`${tos}`}</div>
                
                <div>
                  <div>
                    {contactUrl ? (
                      <a href="{sanitizeUrl(contactUrl)}">
                        {name}
                      </a>
                    ) : (
                      <span>{name}</span>
                    )}
                  </div>
                  <div>
                    {email ? (
                      <a href="{sanitizeUrl(`mailto:${email}`)}">{email}</a>
                    ) : (
                      ""
                    )}
                  </div>
                  <div>
                    {terms ? (
                      <a href="{sanitizeUrl(terms)}">
                        {terms}
                      </a>
                    ) : (
                      "-"
                    )}
                  </div>
                </div>
              
              <div></div>
github SAPConversationalAI / Webchat / src / components / Message / isTyping.js View on Github external
render () {
    const { image } = this.props

    if (image &amp;&amp; sanitizeUrl(image) === 'about:blank') {
      return null
    }

    return (
      <div>
        {image &amp;&amp; <img src="{image}">}
        <img src="https://cdn.cai.tools.sap/webchat/istyping.gif">
      </div>
    )
  }
}
github SAPConversationalAI / Webchat / src / components / Message / Card.js View on Github external
const Card = ({ content, sendMessage, onImageLoaded }) =&gt; {
  const { title, subtitle, imageUrl, buttons } = content

  if (imageUrl &amp;&amp; sanitizeUrl(imageUrl) === 'about:blank') {
    return null
  }

  return (
    <div>
      {imageUrl &amp;&amp; <img src="{imageUrl}">}

      <div>
        <p>{truncate(title, 80)}</p>
        {subtitle &amp;&amp; <p>{truncate(subtitle, 80)}</p>}
      </div>

      {buttons.length ? (
        <div>
          {buttons.slice(0, 3).map((b, i) =&gt; (
            <button></button></div></div>
github italia / developers.italia.it / swagger / components / Hero.js View on Github external
{name}
                      
                    ) : (
                      <span>{name}</span>
                    )}
                  
                  <div>
                    {email ? (
                      <a href="{sanitizeUrl(`mailto:${email}`)}">{email}</a>
                    ) : (
                      ""
                    )}
                  </div>
                  <div>
                    {terms ? (
                      <a href="{sanitizeUrl(terms)}">
                        {terms}
                      </a>
                    ) : (
                      "-"
                    )}
                  </div>
                
              
              <div>
                <a role="button" href="{window.swaggerUrl}">
                  {download}</a></div>
github italia / developers.italia.it / swagger / components / Hero.js View on Github external
{summary}
                          
                        );
                      }
                    })()}
                  
                
                <div>
                  <div>{`${developer}`}</div>
                  <div>{`${channel}`}</div>
                  <div>{`${tos}`}</div>
                </div>
                <div>
                  <div>
                    {contactUrl ? (
                      <a href="{sanitizeUrl(contactUrl)}">
                        {name}
                      </a>
                    ) : (
                      <span>{name}</span>
                    )}
                  </div>
                  <div>
                    {email ? (
                      <a href="{sanitizeUrl(`mailto:${email}`)}">{email}</a>
                    ) : (
                      ""
                    )}
                  </div>
                  <div>
                    {terms ? (
                      <a href="{sanitizeUrl(terms)}"></a></div></div>
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / utils.js View on Github external
export function sanitizeUrl(url) {
  if(typeof url !== "string" || url === "") {
    return ""
  }

  return braintreeSanitizeUrl(url)
}
github SAPConversationalAI / Webchat / src / components / Message / Picture.js View on Github external
const Picture = ({ content, onImageLoaded }) =&gt; {
  if (content &amp;&amp; sanitizeUrl(content) === 'about:blank') {
    return null
  }
  return <img src="{content}">
}

@braintree/sanitize-url

A url sanitizer

MIT
Latest version published 1 day ago

Package Health Score

85 / 100
Full package analysis

Popular @braintree/sanitize-url functions

Similar packages