|
1 | 1 | package handles |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "encoding/json" |
5 | 4 | "fmt" |
6 | 5 | "io" |
7 | 6 | stdpath "path" |
@@ -229,30 +228,15 @@ func FsArchiveList(c *gin.Context, req *ArchiveListReq, user *model.User) { |
229 | 228 | }) |
230 | 229 | } |
231 | 230 |
|
232 | | -type StringOrArray []string |
233 | | - |
234 | | -func (s *StringOrArray) UnmarshalJSON(data []byte) error { |
235 | | - var value string |
236 | | - if err := json.Unmarshal(data, &value); err == nil { |
237 | | - *s = []string{value} |
238 | | - return nil |
239 | | - } |
240 | | - var sliceValue []string |
241 | | - if err := json.Unmarshal(data, &sliceValue); err != nil { |
242 | | - return err |
243 | | - } |
244 | | - *s = sliceValue |
245 | | - return nil |
246 | | -} |
247 | | - |
248 | 231 | type ArchiveDecompressReq struct { |
249 | | - SrcDir string `json:"src_dir" form:"src_dir"` |
250 | | - DstDir string `json:"dst_dir" form:"dst_dir"` |
251 | | - Name StringOrArray `json:"name" form:"name"` |
252 | | - ArchivePass string `json:"archive_pass" form:"archive_pass"` |
253 | | - InnerPath string `json:"inner_path" form:"inner_path"` |
254 | | - CacheFull bool `json:"cache_full" form:"cache_full"` |
255 | | - PutIntoNewDir bool `json:"put_into_new_dir" form:"put_into_new_dir"` |
| 232 | + SrcDir string `json:"src_dir" form:"src_dir"` |
| 233 | + DstDir string `json:"dst_dir" form:"dst_dir"` |
| 234 | + Name []string `json:"name" form:"name"` |
| 235 | + ArchivePass string `json:"archive_pass" form:"archive_pass"` |
| 236 | + InnerPath string `json:"inner_path" form:"inner_path"` |
| 237 | + CacheFull bool `json:"cache_full" form:"cache_full"` |
| 238 | + PutIntoNewDir bool `json:"put_into_new_dir" form:"put_into_new_dir"` |
| 239 | + Overwrite bool `json:"overwrite" form:"overwrite"` |
256 | 240 | } |
257 | 241 |
|
258 | 242 | func FsArchiveDecompress(c *gin.Context) { |
@@ -295,6 +279,7 @@ func FsArchiveDecompress(c *gin.Context) { |
295 | 279 | }, |
296 | 280 | CacheFull: req.CacheFull, |
297 | 281 | PutIntoNewDir: req.PutIntoNewDir, |
| 282 | + Overwrite: req.Overwrite, |
298 | 283 | }) |
299 | 284 | if e != nil { |
300 | 285 | if errors.Is(e, errs.WrongArchivePassword) { |
|
0 commit comments