mirror of https://github.com/cloudreve/Cloudreve
fix(wopi): community edition cannot open WOPI viewer from shared file
parent
d60c3e6bf4
commit
bdaf091aca
|
@ -3,6 +3,7 @@ package explorer
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/cloudreve/Cloudreve/v4/application/constants"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -287,7 +288,7 @@ func (service *WopiService) FileInfo(c *gin.Context) (*WopiFileInfo, error) {
|
||||||
dbfs.WithFilePublicMetadata(),
|
dbfs.WithFilePublicMetadata(),
|
||||||
dbfs.WithExtendedInfo(),
|
dbfs.WithExtendedInfo(),
|
||||||
dbfs.WithNotRoot(),
|
dbfs.WithNotRoot(),
|
||||||
dbfs.WithRequiredCapabilities(dbfs.NavigatorCapabilityDownloadFile, dbfs.NavigatorCapabilityInfo, dbfs.NavigatorCapabilityUploadFile),
|
dbfs.WithRequiredCapabilities(dbfs.NavigatorCapabilityDownloadFile, dbfs.NavigatorCapabilityInfo),
|
||||||
}
|
}
|
||||||
file, err := m.Get(c, uri, opts...)
|
file, err := m.Get(c, uri, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -304,7 +305,7 @@ func (service *WopiService) FileInfo(c *gin.Context) (*WopiFileInfo, error) {
|
||||||
return nil, serializer.NewError(serializer.CodeNotFound, "version not found", nil)
|
return nil, serializer.NewError(serializer.CodeNotFound, "version not found", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
canEdit := file.PrimaryEntityID() == targetEntity.ID() && file.OwnerID() == user.ID
|
canEdit := file.PrimaryEntityID() == targetEntity.ID() && file.OwnerID() == user.ID && uri.FileSystem() == constants.FileSystemMy
|
||||||
siteUrl := settings.SiteURL(c)
|
siteUrl := settings.SiteURL(c)
|
||||||
info := &WopiFileInfo{
|
info := &WopiFileInfo{
|
||||||
BaseFileName: file.DisplayName(),
|
BaseFileName: file.DisplayName(),
|
||||||
|
|
Loading…
Reference in New Issue