MCPcopy Index your code
hub / github.com/writefreely/writefreely / handleCollectionPostRedirect

Function handleCollectionPostRedirect

collections.go:1227–1243  ·  view source on GitHub ↗
(app *App, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1225}
1226
1227func handleCollectionPostRedirect(app *App, w http.ResponseWriter, r *http.Request) error {
1228 vars := mux.Vars(r)
1229 slug := vars["slug"]
1230
1231 cr := &collectionReq{}
1232 err := processCollectionRequest(cr, vars, w, r)
1233 if err != nil {
1234 return err
1235 }
1236
1237 // Normalize the URL, redirecting user to consistent post URL
1238 loc := fmt.Sprintf("/%s", slug)
1239 if !app.cfg.App.SingleUser {
1240 loc = fmt.Sprintf("/%s/%s", cr.alias, slug)
1241 }
1242 return impart.HTTPError{http.StatusFound, loc}
1243}
1244
1245func existingCollection(app *App, w http.ResponseWriter, r *http.Request) error {
1246 reqJSON := IsJSON(r)

Callers

nothing calls this directly

Calls 1

processCollectionRequestFunction · 0.85

Tested by

no test coverage detected