Fix update button on home-posts

This commit is contained in:
Jan-Lukas Else 2021-10-24 18:02:07 +02:00
parent 4123871fd9
commit 64732af4d3
3 changed files with 4 additions and 9 deletions

View File

@ -29,12 +29,7 @@ func (a *goBlog) serveEditorPost(w http.ResponseWriter, r *http.Request) {
if action := r.FormValue("editoraction"); action != "" {
switch action {
case "loadupdate":
parsedURL, err := url.Parse(r.FormValue("url"))
if err != nil {
a.serveError(w, r, err.Error(), http.StatusBadRequest)
return
}
post, err := a.getPost(parsedURL.Path)
post, err := a.getPost(r.FormValue("path"))
if err != nil {
a.serveError(w, r, err.Error(), http.StatusBadRequest)
return
@ -42,7 +37,7 @@ func (a *goBlog) serveEditorPost(w http.ResponseWriter, r *http.Request) {
a.render(w, r, templateEditor, &renderData{
BlogString: blog,
Data: map[string]interface{}{
"UpdatePostURL": parsedURL.String(),
"UpdatePostURL": a.fullPostURL(post),
"UpdatePostContent": a.postToMfItem(post).Properties.Content[0],
},
})

View File

@ -25,7 +25,7 @@
<div id="posteditactions" class="p">
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
<input type="hidden" name="editoraction" value="loadupdate">
<input type="hidden" name="url" value="{{ .Canonical }}">
<input type="hidden" name="path" value="{{ .Data.Path }}">
<input type="submit" value="{{ string .Blog.Lang "update" }}">
</form>
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}">

View File

@ -19,7 +19,7 @@
<div id="posteditactions" class="p">
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
<input type="hidden" name="editoraction" value="loadupdate">
<input type="hidden" name="url" value="{{ .Canonical }}">
<input type="hidden" name="path" value="{{ .Data.Path }}">
<input type="submit" value="{{ string .Blog.Lang "update" }}">
</form>
</div>