Skip to content

Basis server crashes when "b:svg" is used with empty sprite path. #23

@sm0g

Description

@sm0g

OS: Mac OS X El Capitan 10.11.6
Browser: Firefox 52.0.2 (64 bit)
Basis tools: 1.10.2

Steps:

  1. Use SVG sprites file explicitly: basis.resource('/app/ui/base/svg/sprites.svg').fetch().startUse();
  2. Use SVG symbol in a template: <b:svg use="#icon-calendar"/> or <b:svg src="/app/ui/base/svg/sprites.svg" use="#icon-calendar"/>
  3. Important note. basis server rewrite rule is used:
    "^/folder/(.*)$": "http://localhost:8099/index.html [P, QSA]"
  4. It works fine if use "http://localhost:8099" url but crashes in case of "http://localhost:8099/folder/123"

Please see https://github.com/sm0g/basis-server-issue as an example.

Expect to see an icon but basis server crashes. Please see logs:

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at absolutePath (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/files.js:226:34)
    at Object.absolutePath (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/files.js:233:12)
    at resolvePathnameFile (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http-server.js:193:26)
    at Object.defaultRequestHandler [as fn] (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http-server.js:275:5)
    at processRequest (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http-server.js:324:16)
    at next (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http-server.js:326:9)
    at Object.virtualPathMiddleware [as fn] (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http/virtualPath.js:37:16)
    at processRequest (/usr/local/lib/node_modules/basisjs-tools/lib/server/modules/http-server.js:324:16)

P.S.
It works normally in Chrome and IE11.
In build mode icon is just not displayed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions