// If this is true, the human programmers screwed up. So ask for a bug report and fail, fail, fail
log.Error("[PROGRAMMER ERROR] WARNING: Collection.hostName is empty! Federation and many other things will fail! If you're seeing this in the wild, please report this bug and let us know what you were doing just before this: https://github.com/writeas/writefreely/issues/new?template=bug_report.md")
}
ifisSingleUser{
returnc.hostName+"/"
}
returnfmt.Sprintf("%s/%s/",c.hostName,c.Alias)
}
// PrevPageURL provides a full URL for the previous page of collection posts,
log.Error("Couldn't parse readReq form request: %v\n",err)
returnErrBadFormData
}
err=app.formDecoder.Decode(&readReq,r.PostForm)
iferr!=nil{
log.Error("Couldn't decode readReq form request: %v\n",err)
returnErrBadFormData
}
}
ifreadReq.Alias==""{
returnimpart.HTTPError{http.StatusBadRequest,"Need a collection `alias` to read."}
}
ifreadReq.Pass==""{
returnimpart.HTTPError{http.StatusBadRequest,"Please supply a password."}
}
varcollHashedPass[]byte
err:=app.db.QueryRow("SELECT password FROM collectionpasswords INNER JOIN collections ON id = collection_id WHERE alias = ?",readReq.Alias).Scan(&collHashedPass)
iferr!=nil{
iferr==sql.ErrNoRows{
log.Error("No collectionpassword found when trying to read collection %s",readReq.Alias)
returnimpart.HTTPError{http.StatusInternalServerError,"Something went very wrong. The humans have been alerted."}