Fix expires label
This commit is contained in:
@@ -78,8 +78,8 @@ func TestFormatRoundTrips(t *testing.T) {
|
||||
if got, err := ParseDuration(FormatDuration(d)); err != nil || got != d {
|
||||
t.Errorf("FormatDuration(%s) = %q, which parses back to %s (%v)", d, FormatDuration(d), got, err)
|
||||
}
|
||||
// FormatLifetime reaches the upload form as the expiry placeholder, so
|
||||
// what it prints has to be something a caller could type back.
|
||||
// FormatLifetime is shown next to the field a caller types into, so
|
||||
// what it prints has to be something ParseDuration would accept.
|
||||
if got, err := ParseDuration(FormatLifetime(d)); err != nil || got != d {
|
||||
t.Errorf("FormatLifetime(%s) = %q, which parses back to %s (%v)", d, FormatLifetime(d), got, err)
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ type indexPage struct {
|
||||
MaxSize string
|
||||
MaxExpiry string
|
||||
DefaultExpiry string
|
||||
// ExpiryHint is the same lifetime as DefaultExpiry, worded for the form's
|
||||
// "Expires in" field rather than for a row in the limits list: what the
|
||||
// field wants is "never", what the list wants is "unlimited".
|
||||
ExpiryHint string
|
||||
AbsBase string
|
||||
AllowVanity bool
|
||||
MaxSizeBytes int64 // 0 when unlimited; the script checks against it
|
||||
@@ -71,6 +75,7 @@ func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||
MaxSize: config.FormatSize(lim.MaxSize),
|
||||
MaxExpiry: config.FormatLifetime(lim.MaxExpiry),
|
||||
DefaultExpiry: config.FormatLifetime(lim.DefaultExpiry),
|
||||
ExpiryHint: config.FormatDuration(lim.DefaultExpiry),
|
||||
AbsBase: s.absBase(r),
|
||||
AllowVanity: lim.AllowVanity,
|
||||
MaxSizeBytes: lim.MaxSize,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="row">
|
||||
<label class="field">
|
||||
<span>Expires in</span>
|
||||
<input type="text" name="expiry" id="expiry" placeholder="{{.DefaultExpiry}}" autocomplete="off">
|
||||
<input type="text" name="expiry" id="expiry" placeholder="{{.ExpiryHint}}" autocomplete="off">
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>Custom name <em>({{if .AllowVanity}}optional{{else}}needs a token{{end}})</em></span>
|
||||
|
||||
Reference in New Issue
Block a user