Repository: parcel-bundler/parcel
File: packages/core/core/src/requests/PathRequest.js (JavaScript)

Code before:
      if (!validPipelines.has(pipeline)) {
        if (dep.isURL) {
          // This may be a url protocol or scheme rather than a pipeline, such as
          // `url('http://example.com/foo.png')`
          return null;
        } else {
          throw new Error(`Unknown pipeline ${pipeline}.`);
        }
      }
    } else {
      if (dependency.isURL && dependency.moduleSpecifier.startsWith('//')) {
        // A protocol-relative URL, e.g `url('//example.com/foo.png')`
        return null;
      }
      filePath = dependency.moduleSpecifier;
    }

    let queryPart = null;
    if (dependency.isURL) {
      let parsed = URL.parse(filePath);
      if (typeof parsed.pathname !== 'string') {
        throw new Error(`Received URL without a pathname ${filePath}.`);
      }
      filePath = decodeURIComponent(parsed.pathname);
      if (parsed.query != null) {
        queryPart = decodeURIComponent(parsed.query);
      }
    } else {
      let matchesQuerystring = filePath.match(QUERY_PARAMS_REGEX);
      if (matchesQuerystring && matchesQuerystring[2] != null) {
        filePath = matchesQuerystring[1];
        queryPart = matchesQuerystring[2].substr(1);
      }
    }
    if (queryPart != null) {
      query = querystring.parse(queryPart);
    }

    let diagnostics: Array<Diagnostic> = [];
    for (let resolver of resolvers) {
      try {
        let result = await resolver.plugin.resolve({
          filePath,
          dependency: dep,
          options: this.pluginOptions,
          logger: new PluginLogger({origin: resolver.name}),
        });

        if (result) {
          if (result.meta) {
            dependency.meta = {

Review comment (suggestion):
I think this shouldn't be decoded? `decodeURIComponent` decodes a single component of a querystring, not the whole thing. I believe `querystring.parse` below should handle it.

```suggestion
        queryPart = parsed.query;
```

Code after:
      if (!validPipelines.has(pipeline)) {
        if (dep.isURL) {
          // This may be a url protocol or scheme rather than a pipeline, such as
          // `url('http://example.com/foo.png')`
          return null;
        } else {
          throw new Error(`Unknown pipeline ${pipeline}.`);
        }
      }
    } else {
      if (dependency.isURL && dependency.moduleSpecifier.startsWith('//')) {
        // A protocol-relative URL, e.g `url('//example.com/foo.png')`
        return null;
      }
      filePath = dependency.moduleSpecifier;
    }

    let queryPart = null;
    if (dependency.isURL) {
      let parsed = URL.parse(filePath);
      if (typeof parsed.pathname !== 'string') {
        throw new Error(`Received URL without a pathname ${filePath}.`);
      }
      filePath = decodeURIComponent(parsed.pathname);
      if (parsed.query != null) {
        queryPart = parsed.query;
      }
    } else {
      let matchesQuerystring = filePath.match(QUERY_PARAMS_REGEX);
      if (matchesQuerystring && matchesQuerystring[2] != null) {
        filePath = matchesQuerystring[1];
        queryPart = matchesQuerystring[2].substr(1);
      }
    }
    if (queryPart != null) {
      query = querystring.parse(queryPart);
    }

    let diagnostics: Array<Diagnostic> = [];
    for (let resolver of resolvers) {
      try {
        let result = await resolver.plugin.resolve({
          filePath,
          dependency: dep,
          options: this.pluginOptions,
          logger: new PluginLogger({origin: resolver.name}),
        });

        if (result) {
          if (result.meta) {
            dependency.meta = {