You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b574b57
Browse filesBrowse the repository at this point in the historyBrowse files
swarm: give correct error on 0x hash prefix (#16195)
- added a case error struct that contains information about certain error cases
in which we would like to output more information to the client
- added a validation method that iterates and adds the information that is
stored in the error cases
returnfmt.Sprintf(`The requested hash seems to be prefixed with '0x'. You will be redirected to the correct URL within 5 seconds.<br/>
93
+
Please click <a href='%[1]s'>here</a> if your browser does not redirect you.<script>setTimeout("location.href='%[1]s';",5000);</script>`, "/"+uriCopy.String())
94
+
},
95
+
}}
96
+
}
97
+
98
+
//ValidateCaseErrors is a method that process the request object through certain validators
99
+
//that assert if certain conditions are met for further information to log as an error
100
+
funcValidateCaseErrors(r*Request) string {
101
+
for_, err:=rangecaseErrors {
102
+
iferr.Validator(r) {
103
+
returnerr.Msg(r)
104
+
}
105
+
}
106
+
107
+
return""
77
108
}
78
109
79
110
//ShowMultipeChoices is used when a user requests a resource in a manifest which results
@@ -82,10 +113,10 @@ func initErrHandling() {
82
113
//For example, if the user requests bzz:/<hash>/read and that manifest contains entries
83
114
//"readme.md" and "readinglist.txt", a HTML page is returned with this two links.
84
115
//This only applies if the manifest has no default entry
85
-
funcShowMultipleChoices(w http.ResponseWriter, r*http.Request, list api.ManifestList) {
116
+
funcShowMultipleChoices(w http.ResponseWriter, r*Request, list api.ManifestList) {
86
117
msg:=""
87
118
iflist.Entries==nil {
88
-
ShowError(w, r, "Internal Server Error", http.StatusInternalServerError)
119
+
ShowError(w, r, "Could not resolve", http.StatusInternalServerError)
89
120
return
90
121
}
91
122
//make links relative
@@ -102,7 +133,7 @@ func ShowMultipleChoices(w http.ResponseWriter, r *http.Request, list api.Manife
0 commit comments