68546badb3b29cd9d064a09b6445e70c238f7172
CI / go-tests (pull_request) Successful in 2m4s
A row with a status code outside 3xx (e.g. "0" from a typo) was accepted
at load and then panicked net/http's WriteHeader on the first matching
request. ReadCsvRedirects now rejects anything that isn't 300-399, with a
line number in the message, and reports a non-numeric code clearly.
Also defer reader.Close() (the file was left open for the process
lifetime) and drop the unreachable "row == nil" check.
Adds internal/{csv,redirect,http}_test.go covering CSV parsing (valid,
reordered headings, header-only, missing heading, non-numeric and non-3xx
status, ragged row, missing file), Redirects.Find / Redirect.Match, and
ServeHTTP (redirect, 404, query string dropped).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ultrashorty
Really simple HTTP redirection using a CSV file.
Usage
Create a CSV file with the following headings and add in as many redirects as you like:
From,To,Status Code
Start Ultrashorty:
ultrashorty /path/to/redirects.csv
To load changes to the CSV, just stop and restart Ultrashorty.
Languages
Go
92.5%
Dockerfile
7.5%