(ctx context.Context, realPath string, args model.LinkArgs)
| 151 | } |
| 152 | |
| 153 | func (d *Strm) linkRealFile(ctx context.Context, realPath string, args model.LinkArgs) (*model.Link, error) { |
| 154 | storage, actualPath, err := op.GetStorageAndActualPath(realPath) |
| 155 | if err != nil { |
| 156 | return nil, err |
| 157 | } |
| 158 | if !args.Redirect { |
| 159 | link, _, linkErr := op.Link(ctx, storage, actualPath, args) |
| 160 | return link, linkErr |
| 161 | } |
| 162 | obj, err := fs.Get(ctx, realPath, &fs.GetArgs{NoLog: true}) |
| 163 | if err != nil { |
| 164 | return nil, err |
| 165 | } |
| 166 | if common.ShouldProxy(storage, obj.GetName()) { |
| 167 | api := common.GetApiUrl(args.HttpReq) |
| 168 | if api == "" { |
| 169 | api = strings.TrimSuffix(strings.TrimSpace(d.SiteUrl), "/") |
| 170 | } |
| 171 | if api == "" { |
| 172 | api = common.GetApiUrl(nil) |
| 173 | } |
| 174 | return &model.Link{URL: fmt.Sprintf("%s/p%s?sign=%s", api, utils.EncodePath(realPath, true), d.generateSign(realPath))}, nil |
| 175 | } |
| 176 | link, _, linkErr := op.Link(ctx, storage, actualPath, args) |
| 177 | return link, linkErr |
| 178 | } |
| 179 | |
| 180 | func (d *Strm) syncLocalDir(ctx context.Context, virtualDir string, objs []model.Obj) { |
| 181 | d.syncLocalDirWithMode(ctx, virtualDir, objs, d.normalizedMode) |
no test coverage detected