Skip to content

Commit 4e9e758

Browse files
committed
feat(archive): stop walking tree node when client disconnected
Picked from: 8803f62
1 parent d0bac30 commit 4e9e758

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/serverHandler/archive.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ func (h *aliasHandler) visitTreeNode(
5252
childSelections []string,
5353
archiveCallback archiveCallback,
5454
) {
55+
select {
56+
case <-r.Context().Done():
57+
return
58+
default:
59+
break
60+
}
61+
5562
needAuth, _ := h.needAuth("", urlPath, fsPath)
5663
userId, _, err := h.verifyAuth(r, urlPath, fsPath)
5764
if needAuth && err != nil {
@@ -105,7 +112,7 @@ func (h *aliasHandler) visitTreeNode(
105112
}
106113

107114
if fInfo.IsDir() && h.index.match(urlPath, fsPath, userId) {
108-
childInfos, _, _ := h.mergeAlias(urlPath, fInfo, childInfos, true)
115+
childInfos, _, _ = h.mergeAlias(urlPath, fInfo, childInfos, true)
109116
childInfos = h.FilterItems(childInfos)
110117

111118
// childInfo can be regular dir/file, or aliased item that shadows regular dir/file

0 commit comments

Comments
 (0)