How to use the urlencode.decode function in urlencode

To help you get started, we’ve selected a few urlencode 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 felixfbecker / vscode-php-debug / src / paths.ts View on Github external
export function convertDebuggerPathToClient(
    fileUri: string | url.Url,
    pathMapping?: { [index: string]: string }
): string {
    let localSourceRoot: string | undefined
    let serverSourceRoot: string | undefined
    if (typeof fileUri === 'string') {
        fileUri = url.parse(fileUri)
    }
    // convert the file URI to a path
    let serverPath = decode(fileUri.pathname!)
    // strip the trailing slash from Windows paths (indicated by a drive letter with a colon)
    const serverIsWindows = /^\/[a-zA-Z]:\//.test(serverPath)
    if (serverIsWindows) {
        serverPath = serverPath.substr(1)
    }
    if (pathMapping) {
        for (const mappedServerPath of Object.keys(pathMapping)) {
            const mappedLocalSource = pathMapping[mappedServerPath]
            // normalize slashes for windows-to-unix
            const serverRelative = (serverIsWindows ? path.win32 : path.posix).relative(mappedServerPath, serverPath)
            if (serverRelative.indexOf('..') !== 0) {
                serverSourceRoot = mappedServerPath
                localSourceRoot = mappedLocalSource
                break
            }
        }
github JGAntunes / hapi-uploader / lib / uploader.js View on Github external
function saveFile (data, fileName, cb) {
    const mimeType = data.hapi.headers['content-type']
    const name = fileName || urlencode.decode(data.hapi.filename, 'utf8')
    const file = data
    const filePath = path.join(uploadPath, name)
    const fileStream = fs.createWriteStream(filePath)
    const fileInfo = {
      mimeType,
      name,
      path: filePath,
      extension: Mime.extension(mimeType)
    }

    fileStream.on('error', (err) => {
      if (err && err.errno === 34) {
        // Still not sure if throw is the best to go here
        log(['error'], new Error(
          'Error while saving file, possible issue with path - ' +
          err
github sinfo / cannon-api / server / resources / file.js View on Github external
function saveFile (kind, data, cb) {
  const mimeType = data.hapi.headers['content-type']
  const fileInfo = {
    id: kind + '_' + Math.random().toString(36).substr(2, 20),
    kind: kind,
    name: urlencode.decode(data.hapi.filename)
  }
  const file = data
  const path = config.upload.path + '/' + fileInfo.id
  const fileStream = fs.createWriteStream(path)

  fileStream.on('error', (err) => {
    if (err && err.errno === 34) {
      log.error('[file] issue with file path')
    }
    log.error({err: err}, '[file] error uploading file')
    return cb(Boom.internal())
  })

  file.pipe(fileStream)

  file.on('end', (err) => {
github Tencent / LuaPanda / src / code / server / codeTools.ts View on Github external
export function urlDecode(url):string{
	return urlencode.decode(url);
}
github Andro999b / torrent-player / server / service / trackers / providers / LimeTorrentsProvider.js View on Github external
getInfoUrl(resultsId) {
        const { baseUrl } = this.config
        return baseUrl + urlencode.decode(resultsId)
    }
github Andro999b / torrent-player / server / service / trackers / providers / 1337XTOProvider.js View on Github external
getInfoUrl(resultsId) {
        const { baseUrl } = this.config
        return baseUrl + urlencode.decode(resultsId)
    }
github angular / dgeni-packages / base / processors / checkAnchorLinks.js View on Github external
.forEach(link => {
            const normalizedLink = path.join(this.webRoot, resolveUrl(linkInfo.path, encode.decode(link), this.base));
            if (!this.pathVariants.some(pathVariant => allValidReferences[normalizedLink + pathVariant])) {
              unmatchedLinks.push(link);
            }
          });
github sofastack / sofa-rpc-node / lib / registry / zk / data_client.js View on Github external
            const originAddressList = children.map(url => urlencode.decode(url));
            const addressList = originAddressList.filter(url => this._isMatch(config, url));
github cdglabs / prolog-viz / src / app / components / components / Input.jsx View on Github external
componentDidUpdate: function() {
    var cm = this.refs.codeMirror.editor;

    var exampleName = urlencode.decode(this.getParams().exampelName);
    if (exampleName) {
      for (var {name: n, code: c } of this.state.examples) {
        if (n === exampleName) {
          if (cm && c !== cm.getValue()) {
            this.showingExample = true;
            cm.setValue(c);
            this.showingExample = false;
          }
          break;
        }
      }
    }

    var {traceIter, syntaxError, syntaxHighlight} = this.state;
    if (traceIter) {
      var trace = traceIter.getCurrentTrace();
github Andro999b / torrent-player / server / service / trackers / providers / DirectMediaProvider.js View on Github external
getInfoUrl(resultsId) {
        return this._absoluteUrl(urlencode.decode(resultsId))
    }
}

urlencode

encodeURIComponent with charset

MIT
Latest version published 6 months ago

Package Health Score

67 / 100
Full package analysis