Make webdav namespace configurable across services

This commit is contained in:
Ishank Arora
2021-06-25 10:05:20 +02:00
parent 3e815601dd
commit 89f8320c74
10 changed files with 52 additions and 19 deletions
+10 -8
View File
@@ -29,7 +29,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,
@@ -46,12 +47,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
@@ -160,7 +162,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 {