Skip to content

issue about filePath with query #49

@kuangyeheng

Description

@kuangyeheng

tips: My English level is so low T.T if you can't understand what i say, please don't laugh at me =。=
when html has tag:

<script src="abc/abc/abc.js?v=123456"></script>

then will throw error file is not found

And i change getSourcepath method like below:

getSourcepath (filepath, htmlpath, rootpath) {
    if (filepath) {
      // Relative path
      if (htmlpath && filepath.indexOf('./') == 0 || filepath.indexOf('../') == 0) {
        filepath = path.resolve(path.dirname(htmlpath), filepath);
      } else {
        // Strip leading '/'
        if (filepath.indexOf('/') == 0) filepath = filepath.slice(1);
      }
      if (~filepath.indexOf('#')) filepath = filepath.split('#');

      return Array.isArray(filepath)
        ? [path.resolve(rootpath, filepath[0]).replace(/\?.*$/,''), filepath[1]]
        : [path.resolve(rootpath, filepath).replace(/\?.*$/,''), ''];
    }

    return ['', ''];
  }

then all is ok

i hope you can fixed this bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions