Browse Source

Import: say why the upload form-state check failed

The CSRF failure on /import/upload used one generic message. It now tells
apart an empty upload, a missing token, and a session mismatch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
master
Daniel Covington 2 weeks ago
parent
commit
d7b8594a58
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      app/controllers/ImportController.asp

+ 7
- 1
app/controllers/ImportController.asp View File

@@ -47,7 +47,13 @@ Class ImportController_Class
up.Upload up.Upload


If Not Csrf_Valid("import", up.Form("csrf")) Then If Not Csrf_Valid("import", up.Form("csrf")) Then
Flash().AddError "Invalid form state. Please try again."
If up.FormElements.Count = 0 Then
Flash().AddError "Invalid form state: the upload was not received (" & Request.TotalBytes & " bytes). Please try again."
ElseIf Len(up.Form("csrf")) = 0 Then
Flash().AddError "Invalid form state: the form token was missing from the upload. Please try again."
Else
Flash().AddError "Invalid form state: your session expired or changed. Reload this page and try again."
End If
Response.Redirect "/import" Response.Redirect "/import"
End If End If




Loading…
Cancel
Save

Powered by TurnKey Linux.