Skip to content

Fix: WSL telemetry causes URL parsing error due to spaces in OS name #2198

@sio-funmatsu

Description

@sio-funmatsu

Problem

When running IHP on WSL (Windows Subsystem for Linux), the dev server crashes with a URL parsing error:

redirectToPath: Unable to parse url: "https://downloads.digitallyinduced.com/ihp/1.4.0/linux (WSL)/x86_64/..."

The issue is that the OS name "linux (WSL)" contains spaces and parentheses, which are not URL-safe characters.

Root Cause

In ihp-ide/IHP/Telemetry.hs, the WSL OS name was set to "linux (WSL)":

let opsys
     | System.os == "linux" && iswin = "linux (WSL)"  -- contains spaces!
     | otherwise = System.os

When this is sent to the telemetry server and used in a URL path, it causes a parsing error.

Proposed Fix

Change the OS name to a URL-safe format: "linux-wsl"

normalizeOsName :: String -> Bool -> String
normalizeOsName "linux" True = "linux-wsl"
normalizeOsName osName _ = osName

Questions for Maintainers

  1. Will the telemetry server correctly handle the new OS identifier "linux-wsl"?
  2. Does the server need to be updated to recognize this new identifier?
  3. Should the server-side code also be fixed to properly URL-encode OS names when building URLs?

Changes Included in PR

  • Refactored OS name normalization into a pure function normalizeOsName
  • Added comprehensive tests for the telemetry module
  • Added devenv test configuration

Environment

  • OS: Linux (WSL2)
  • IHP Version: 1.4.0

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