Merge pull request #2199 from ishank011/webdav-ns-config

Make webdav namespace configurable across services
This commit is contained in:
Michael Barz
2021-06-25 11:39:36 +02:00
committed by GitHub
10 changed files with 52 additions and 19 deletions
+10 -8
View File
@@ -30,7 +30,8 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
logger.Fatal().Err(err).Msg("resolutions not configured correctly")
}
svc := Thumbnail{
serviceID: options.Config.Server.Namespace + "." + options.Config.Server.Name,
serviceID: options.Config.Server.Namespace + "." + options.Config.Server.Name,
webdavNamespace: options.Config.Thumbnail.WebdavNamespace,
manager: thumbnail.NewSimpleManager(
resolutions,
options.ThumbnailStorage,
@@ -47,12 +48,13 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler {
// Thumbnail implements the GRPC handler.
type Thumbnail struct {
serviceID string
manager thumbnail.Manager
webdavSource imgsource.Source
cs3Source imgsource.Source
logger log.Logger
cs3Client gateway.GatewayAPIClient
serviceID string
webdavNamespace string
manager thumbnail.Manager
webdavSource imgsource.Source
cs3Source imgsource.Source
logger log.Logger
cs3Client gateway.GatewayAPIClient
}
// GetThumbnail retrieves a thumbnail for an image
@@ -161,7 +163,7 @@ func (g Thumbnail) handleWebdavSource(ctx context.Context, req *v0proto.GetThumb
statPath = path.Join("/public", src.PublicLinkToken, req.Filepath)
} else {
auth = src.RevaAuthorization
statPath = path.Join("/home", req.Filepath)
statPath = path.Join(g.webdavNamespace, req.Filepath)
}
sRes, err := g.stat(statPath, auth)
if err != nil {