Skip to content

Commit 5e1d29a

Browse files
committed
fix(serverHandler): preserve QS context after mutate
1 parent cb4ae8a commit 5e1d29a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/serverHandler/mutate.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ func (h *handler) mutate(w http.ResponseWriter, r *http.Request, data *responseD
4040
if qsIndex >= 0 {
4141
reqPath = reqPath[:qsIndex]
4242
}
43+
44+
ctxQsList := r.Form["contextquerystring"]
45+
ctxQsListLen := len(ctxQsList)
46+
if ctxQsListLen > 0 {
47+
ctxQs := ctxQsList[ctxQsListLen-1]
48+
if len(ctxQs) > 0 {
49+
reqPath += ctxQs
50+
}
51+
}
4352
http.Redirect(w, r, reqPath, http.StatusFound)
4453
}
4554
}

src/tpl/frontend/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<div class="panel mkdir">
3333
<form method="POST" action="{{.SubItemPrefix}}?mkdir">
3434
<input type="text" autocomplete="off" name="name" class="name"/>
35+
<input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/>
3536
<input type="submit" value="{{.Trans.MkdirLabel}}" class="submit"/>
3637
</form>
3738
</div>
@@ -46,6 +47,7 @@
4647
<div class="panel upload">
4748
<form method="POST" action="{{.SubItemPrefix}}?upload" enctype="multipart/form-data">
4849
<input type="file" name="file" multiple="multiple" class="file"/>
50+
<input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/>
4951
<button type="submit" class="submit">{{.Trans.UploadLabel}}</button>
5052
</form>
5153
</div>
@@ -103,7 +105,7 @@
103105
<span class="field size">{{.DisplaySize}}</span>
104106
<span class="field time">{{.DisplayTime}}</span>
105107
</a>
106-
{{if and (not $isDownload) .DeleteUrl}}<form class="delete" action="{{$SubItemPrefix}}" onsubmit="return confirmDelete(this)"><input type="hidden" name="delete"/><input type="hidden" name="name" value="{{.DeleteUrl}}"/><button type="submit">x</button></form>{{end}}
108+
{{if and (not $isDownload) .DeleteUrl}}<form class="delete" action="{{$SubItemPrefix}}" onsubmit="return confirmDelete(this)"><input type="hidden" name="delete"/><input type="hidden" name="name" value="{{.DeleteUrl}}"/><input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/><button type="submit">x</button></form>{{end}}
107109
</li>
108110
{{end}}
109111
</ul>

0 commit comments

Comments
 (0)