Skip to content

Commit

Permalink
Fix: doc preview src of local storage policy starts with ":/"
Browse files Browse the repository at this point in the history
  • Loading branch information
YUDONGLING authored Sep 21, 2023
1 parent 3ffce1e commit f180db9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion service/explorer/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ func (service *FileIDService) CreateDocPreviewSession(ctx context.Context, c *gi
return serializer.Err(serializer.CodeNotSet, err.Error(), err)
}

// For newer version of Cloudreve - Local Policy
// When do not use a cdn, the downloadURL withouts hosts, like "/api/v3/file/download/xxx"
if strings.HasPrefix(downloadURL, "/") {
downloadURL = path.Join(model.GetSiteURL().String(), downloadURL)
downloadURL = model.GetSiteURL().ResolveReference(downloadURL).String()

Check failure on line 233 in service/explorer/file.go

View workflow job for this annotation

GitHub Actions / Test

cannot use downloadURL (variable of type string) as *url.URL value in argument to model.GetSiteURL().ResolveReference
}

var resp serializer.DocPreviewSession
Expand Down

0 comments on commit f180db9

Please sign in to comment.