Use stable files API URLs for vendor logo fields

CommonThirdParty.logoUrl and TrustCenterReference.logoUrl were
returning expiring S3 presigned URLs, which break if cached or
shared past their TTL.

Replace with stable /api/files/v1/{id} application URLs.
file.Service now generates these via baseurl; a new filesign
package owns presigning for the files/v1 HTTP handler that
does the internal redirect.

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
Ludovic Vielle
2026-06-03 10:21:02 +02:00
parent 383ea5a2d4
commit 6c072a2f7b
14 changed files with 115 additions and 116 deletions

View File

@@ -22,7 +22,7 @@ import (
"github.com/go-chi/chi/v5"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/file"
"go.probo.inc/probo/pkg/filesign"
"go.probo.inc/probo/pkg/gid"
)
@@ -30,10 +30,10 @@ const presignedURLExpiry = 1 * time.Hour
type Handler struct {
logger *log.Logger
fileSvc *file.Service
fileSvc *filesign.Service
}
func NewMux(logger *log.Logger, fileSvc *file.Service) *chi.Mux {
func NewMux(logger *log.Logger, fileSvc *filesign.Service) *chi.Mux {
h := &Handler{
logger: logger,
fileSvc: fileSvc,
@@ -55,7 +55,7 @@ func (h *Handler) handleGetPublicFile(w http.ResponseWriter, r *http.Request) {
return
}
presignedURL, err := h.fileSvc.GetPublicFileURL(r.Context(), fileID, presignedURLExpiry)
presignedURL, err := h.fileSvc.GeneratePresignedFileURL(r.Context(), fileID, presignedURLExpiry)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
http.NotFound(w, r)