Send file info
This commit is contained in:
@@ -27,7 +27,14 @@ func (h *FileHandler) ShareUrl(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *FileHandler) LinkInfo(c *gin.Context) {
|
||||
|
||||
resp, err := h.FileUrlCtrl.Info(c)
|
||||
if err != nil {
|
||||
handler.Error(c, stacktrace.Propagate(err, ""))
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"file": resp,
|
||||
})
|
||||
}
|
||||
|
||||
func (h *FileHandler) LinkThumbnail(c *gin.Context) {
|
||||
|
||||
@@ -110,6 +110,11 @@ func (c *FileLinkController) UpdateSharedUrl(ctx *gin.Context, req ente.UpdateFi
|
||||
return c.mapRowToFileUrl(ctx, fileLinkRow), nil
|
||||
}
|
||||
|
||||
func (c *FileLinkController) Info(ctx *gin.Context) (*ente.File, error) {
|
||||
accessContext := auth.MustGetFileLinkAccessContext(ctx)
|
||||
return c.FileRepo.GetFileAttributes(accessContext.FileID)
|
||||
}
|
||||
|
||||
// VerifyPassword verifies if the user has provided correct pw hash. If yes, it returns a signed jwt token which can be
|
||||
// used by the client to pass in other requests for public collection.
|
||||
// Having a separate endpoint for password validation allows us to easily rate-limit the attempts for brute-force
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var filePasswordWhiteListedURLs = []string{"/file-link/info", "/file-link/verify-password"}
|
||||
var filePasswordWhiteListedURLs = []string{"/file-link/pass-info", "/file-link/verify-password"}
|
||||
|
||||
// FileLinkMiddleware intercepts and authenticates incoming requests
|
||||
type FileLinkMiddleware struct {
|
||||
|
||||
Reference in New Issue
Block a user