Skip to content

addArchiveStream ignores false values for hasAudio/hasVideo optionsΒ #371

@hidday

Description

@hidday

hasVideo: archiveOptions.hasVideo ? archiveOptions.hasVideo : true,

Issue Description

🐞 Bug Summary

The addArchiveStream function incorrectly ignores explicit false values passed for hasAudio or hasVideo.
When { hasVideo: false } or { hasAudio: false } is provided, the function treats the value as falsy and defaults to true, resulting in unwanted audio/video being added to the archive.

πŸ’‘ Expected Behavior

If a caller explicitly passes false for either option, that value should be respected.

βš™οΈ Current Behavior

hasAudio: archiveOptions.hasAudio ? archiveOptions.hasAudio : true,
hasVideo: archiveOptions.hasVideo ? archiveOptions.hasVideo : true,

Because of the truthy check, any falsy value (including false) triggers the default true.

βœ… Proposed Fix

Replace the truthy checks with nullish coalescing (??) to only default when the option is undefined or null:

hasAudio: archiveOptions.hasAudio ?? true,
hasVideo: archiveOptions.hasVideo ?? true,

πŸ” Impact

  • Developers cannot currently disable audio or video streams when adding to an archive.
  • Causes incorrect archive configuration and potential unnecessary media inclusion.

🧩 Affected Module

archive.js β†’ addArchiveStream()

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