Skip to content

Empty branch query parameter creates a '' branch and silently splits a document away from main #68

Description

@bgeils

Summary

Both route layers default the branch with nullish coalescing (req.getQuery('branch') ?? 'main' — src/server.js:41 and the api layer in v0.7.0). Under uWS a present but empty branch= query yields '', not undefined — so the request creates and serves a room whose branch is the empty string, silently splitting its live stream and persisted snapshots away from main. From the user's perspective the document "loses" content depending on which URL variant a client built.

Suggested fix

- const branch = req.getQuery('branch') ?? 'main'
+ const branch = req.getQuery('branch') || 'main'

Both an absent and an empty branch mean "the default branch"; an empty-string branch is never a meaningful namespace. (Our clients all send branch=main explicitly as a workaround, but any direct API caller can still hit this.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions