Skip to content

Web GUI: DUT IDs containing # break history lookup due to missing URL encoding #1269

@upview

Description

@upview

Problem Description

When a DUT ID contains the # character (e.g., BOARD#123), the web GUI history feature fails to retrieve the correct test record. The # is interpreted by the browser as a URL fragment identifier, truncating the query parameter.

Steps to Reproduce

  1. Run an OpenHTF test with a DUT ID containing # (e.g., PCB#001)
  2. Open the station server web GUI
  3. View the History panel
  4. Click on a history item to load it
  5. If the item was created via prependItemFromTestState, the retrieveFileName call will fail

Root Cause

In openhtf/output/web_gui/src/app/stations/station/history.service.ts lines 163-165:

const url =
    (`${baseUrl}/history?dutId=${historyItem.dutId}` +
     `&startTimeMillis=${historyItem.startTimeMillis}`);

The dutId is interpolated directly into the URL without encodeURIComponent().

When dutId is BOARD#123:

  • URL becomes: /history?dutId=BOARD#123&startTimeMillis=...
  • Browser interprets #123&startTimeMillis=... as a fragment (anchor)
  • Only /history?dutId=BOARD is sent to the server
  • Server receives incomplete dutId, returning no matching history items

Other Affected Characters

This bug affects any DUT ID containing URL-reserved characters: #, &, =, ?, %, +, spaces, etc.

Proposed Fix

const url =
    (`${baseUrl}/history?dutId=${encodeURIComponent(historyItem.dutId)}` +
     `&startTimeMillis=${historyItem.startTimeMillis}`);

Alternatively, Angular's HttpClient can handle parameter encoding automatically:

return this.http.get<RawHistoryItemList>(url, {
  params: {
    dutId: historyItem.dutId,
    startTimeMillis: String(historyItem.startTimeMillis)
  }
}).toPromise();

Environment

  • OpenHTF version: latest (master branch)
  • Browser: Any (Chrome, Firefox, Safari)
  • File: openhtf/output/web_gui/src/app/stations/station/history.service.ts

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