MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / SharingArchiveList

Function SharingArchiveList

server/handles/sharing.go:150–189  ·  view source on GitHub ↗
(c *gin.Context, req *ArchiveListReq)

Source from the content-addressed store, hash-verified

148}
149
150func SharingArchiveList(c *gin.Context, req *ArchiveListReq) {
151 if !setting.GetBool(conf.ShareArchivePreview) {
152 common.ErrorStrResp(c, "sharing archives previewing is not allowed", 403)
153 return
154 }
155 sid, path, _ := strings.Cut(strings.TrimPrefix(req.Path, "/"), "/")
156 if sid == "" {
157 common.ErrorStrResp(c, "invalid share id", 400)
158 return
159 }
160 innerArgs := model.ArchiveInnerArgs{
161 ArchiveArgs: model.ArchiveArgs{
162 LinkArgs: model.LinkArgs{
163 Header: c.Request.Header,
164 Type: c.Query("type"),
165 },
166 Password: req.ArchivePass,
167 },
168 InnerPath: utils.FixAndCleanPath(req.InnerPath),
169 }
170 s, objs, err := sharing.ArchiveList(c.Request.Context(), sid, path, model.SharingArchiveListArgs{
171 ArchiveListArgs: model.ArchiveListArgs{
172 ArchiveInnerArgs: innerArgs,
173 Refresh: req.Refresh,
174 },
175 Pwd: req.Password,
176 })
177 if dealError(c, err) {
178 return
179 }
180 _ = countAccess(c.ClientIP(), s)
181 total, objs := pagination(objs, &req.PageReq)
182 ret, _ := utils.SliceConvert(objs, func(src model.Obj) (ObjResp, error) {
183 return toObjsRespWithoutSignAndThumb(src), nil
184 })
185 common.SuccessResp(c, common.PageResp{
186 Content: ret,
187 Total: int64(total),
188 })
189}
190
191func SharingDown(c *gin.Context) {
192 sid := c.Request.Context().Value(conf.SharingIDKey).(string)

Callers 1

FsArchiveListSplitFunction · 0.85

Calls 10

GetBoolFunction · 0.92
ErrorStrRespFunction · 0.92
FixAndCleanPathFunction · 0.92
ArchiveListFunction · 0.92
SliceConvertFunction · 0.92
SuccessRespFunction · 0.92
dealErrorFunction · 0.85
countAccessFunction · 0.85
paginationFunction · 0.85

Tested by

no test coverage detected