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 committed Sep 21, 2023
1 parent f180db9 commit 792ec1d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion service/explorer/file.go
Expand Up @@ -230,7 +230,11 @@ func (service *FileIDService) CreateDocPreviewSession(ctx context.Context, c *gi
// 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 = model.GetSiteURL().ResolveReference(downloadURL).String()
downloadURI, err := url.Parse(downloadURL)
if err != nil {
return serializer.Err(serializer.CodeNotSet, err.Error(), err)
}
downloadURL = model.GetSiteURL().ResolveReference(downloadURI).String()
}

var resp serializer.DocPreviewSession
Expand Down

0 comments on commit 792ec1d

Please sign in to comment.