(ctx context.Context, dst, sub string, args model.ArchiveInnerArgs)
| 190 | } |
| 191 | |
| 192 | func (d *Alias) extract(ctx context.Context, dst, sub string, args model.ArchiveInnerArgs) (*model.Link, error) { |
| 193 | reqPath := stdpath.Join(dst, sub) |
| 194 | storage, reqActualPath, err := op.GetStorageAndActualPath(reqPath) |
| 195 | if err != nil { |
| 196 | return nil, err |
| 197 | } |
| 198 | if _, ok := storage.(driver.ArchiveReader); ok { |
| 199 | if _, ok := storage.(*Alias); !ok && !args.Redirect { |
| 200 | link, _, err := op.DriverExtract(ctx, storage, reqActualPath, args) |
| 201 | return link, err |
| 202 | } |
| 203 | _, err = fs.Get(ctx, reqPath, &fs.GetArgs{NoLog: true}) |
| 204 | if err != nil { |
| 205 | return nil, err |
| 206 | } |
| 207 | if common.ShouldProxy(storage, stdpath.Base(sub)) { |
| 208 | link := &model.Link{ |
| 209 | URL: fmt.Sprintf("%s/ap%s?inner=%s&pass=%s&sign=%s", |
| 210 | common.GetApiUrl(args.HttpReq), |
| 211 | utils.EncodePath(reqPath, true), |
| 212 | utils.EncodePath(args.InnerPath, true), |
| 213 | url.QueryEscape(args.Password), |
| 214 | sign.SignArchive(reqPath)), |
| 215 | } |
| 216 | if args.HttpReq != nil && d.ProxyRange { |
| 217 | link.RangeReadCloser = common.NoProxyRange |
| 218 | } |
| 219 | return link, nil |
| 220 | } |
| 221 | link, _, err := op.DriverExtract(ctx, storage, reqActualPath, args) |
| 222 | return link, err |
| 223 | } |
| 224 | return nil, errs.NotImplement |
| 225 | } |
no test coverage detected