Skip to content

Ignore invalid download paths instead of panicking - #109

Merged
pfeiferj merged 1 commit into
pfeiferj:mainfrom
FrogAi:fix/download-path-panic
Aug 9, 2026
Merged

Ignore invalid download paths instead of panicking#109
pfeiferj merged 1 commit into
pfeiferj:mainfrom
FrogAi:fix/download-path-panic

Conversation

@FrogAi

@FrogAi FrogAi commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Treat a download path with no submenu separator as an ignorable input instead of panicking.

Motivation

getDataForPath panics when a download path contains no . separator. Every caller reaches it from Download, which Settings.Handle runs as a goroutine, so an unrecognized MapdInputType_download value does not fail the download — it takes down the process. mapd runs that download alongside the 50 ms loop publishing speed-limit and curve-speed output, so a single malformed command string from a fork ends live driving output until the daemon is restarted.

The path string is fork-supplied (docs/inputs.md), and the failure needs nothing exotic: "ohio" instead of "north-america.ohio" is enough.

A well-formed path naming a region that does not exist already behaves harmlessly — the menu lookup misses and returns a zero LocationData, so the download resolves to zero files. This change gives the malformed case that same outcome and logs why, rather than treating it as unrecoverable.

Behavior

Download path Base 68813e05 Head
north-america.ohio Downloads the region Unchanged
ohio (no separator) Panic; daemon exits Warning logged; resolves to zero files
"" Panic; daemon exits Warning logged; resolves to zero files
north-america.not-a-place Zero files, no message Unchanged

Validation

  • An audit-only harness confirmed the panic on Base for "ohio", "", and "." — both directly and through countTotalFiles, the call path Download takes before any download begins — and confirmed Head returns a zero value with a warning on all three while a populated menu entry still resolves to its real record.
  • go build ./..., go vet ./..., and go test ./... pass on Head.

Compatibility

  • No schema, settings, CLI, published-message, or offline-map format changes.
  • No signature changes; getDataForPath is unexported and its callers are untouched.
  • Valid and unknown-but-well-formed paths behave exactly as before.
  • Does not conflict with #107: that PR restructures this file but leaves getDataForPath byte-identical, so the two apply cleanly in either merge order.
  • The panic is the only crash addressed here. It does not add validation feedback for unknown region names, which remain a silent zero-file download on both Base and Head.

@pfeiferj
pfeiferj merged commit 14cb154 into pfeiferj:main Aug 9, 2026
@FrogAi
FrogAi deleted the fix/download-path-panic branch August 10, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants