fix(cloudreve): add domain to the download url if not exists (#6339 close #6265)

* fix: correct the download url got by Cloudreve driver

* fix: add an condition to the correction
This commit is contained in:
tukipona 2024-04-12 21:45:16 +08:00 committed by GitHub
parent c3c5181847
commit 793a4ea6ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,6 +71,9 @@ func (d *Cloudreve) Link(ctx context.Context, file model.Obj, args model.LinkArg
if err != nil {
return nil, err
}
if strings.HasPrefix(dUrl, "/api") {
dUrl = d.Address + dUrl
}
return &model.Link{
URL: dUrl,
}, nil