mqv:filter is silently ignored due to operator precedence bug

Open Beginner friendly
#1,508 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
networking

Research direction

Search the TypeScript source for requestUri.pathname.slice(1) and mqv:filter to locate the request and filter handling entry point. Reproduce the root-URL case with the shown form and verify that the filter is preserved when the pathname slice is empty; add or update a regression test if the surrounding code has tests.

Written by the indexing model from the issue text.

Description

binding-mqtt bug good first issue

the mqv:filter is being "silently ignored" in cases where requestUri.pathname.slice(1) returns an empty string "" (which is falsy), but the nullish coalescing operator ?? only triggers on null or undefined, not on empty strings.

foexample:

URL: mqtt://broker.example.com/
Form has: { "mqv:filter": "sensors/+/temperature" }

Current behavior:

requestUri.pathname = "/"
requestUri.pathname.slice(1) = "" (empty string, not null/undefined)
filter = "" (mqv:filter is ignored!)

Expected behavior:

filter should be "sensors/+/temperature"

Dominant language
TypeScript
Stars
193
Forks
100
Avg merge
3d 4h
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-thingweb/node-wot

All issues in eclipse-thingweb/node-wot

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.