mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Change 404 to 500 on error and fix method for removing episodes
This commit is contained in:
parent
6916e41cfc
commit
99f2893980
|
@ -76,9 +76,12 @@ func CreateEpisode(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func RemoveEpisode(episode string) {
|
||||
func RemoveEpisode(w http.ResponseWriter, r *http.Request) {
|
||||
// Episode should be the full MP3 filename
|
||||
// Remove MP3 first
|
||||
r.ParseMultipartForm(32 << 20)
|
||||
|
||||
episode := strings.Join(r.Form["episode"],"")
|
||||
os.Remove(episode)
|
||||
sn := strings.Replace(episode, ".mp3", "_SHOWNOTES.md", 2)
|
||||
os.Remove(sn)
|
||||
|
|
|
@ -48,8 +48,8 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if err == nil {
|
||||
w.Write(data)
|
||||
} else {
|
||||
w.WriteHeader(404)
|
||||
w.Write([]byte("404 Something went wrong - " + http.StatusText(404)))
|
||||
w.WriteHeader(500)
|
||||
w.Write([]byte("500 Something went wrong - " + http.StatusText(500)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,8 @@ func AdminHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if err == nil {
|
||||
w.Write(data)
|
||||
} else {
|
||||
w.WriteHeader(404)
|
||||
w.Write([]byte("404 Something went wrong - " + http.StatusText(404)))
|
||||
w.WriteHeader(500)
|
||||
w.Write([]byte("500 Something went wrong - " + http.StatusText(500)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue