From a514f4dcfa75a2efcc96f73970f5b3480ac8d6d3 Mon Sep 17 00:00:00 2001 From: MEHMETKECECI Date: Mon, 16 Feb 2026 12:25:54 +0300 Subject: [PATCH] fix: enforce absolute pdf font path --- svc/routes/pdf_assets.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/svc/routes/pdf_assets.go b/svc/routes/pdf_assets.go index 0752bb4..e1a8558 100644 --- a/svc/routes/pdf_assets.go +++ b/svc/routes/pdf_assets.go @@ -2,6 +2,7 @@ package routes import ( "fmt" + "log" "os" "path/filepath" "strings" @@ -17,16 +18,15 @@ func resolvePdfAssetPath(name string) (string, error) { return "", fmt.Errorf("env PDF_FONT_DIR not set") } - // Absolute yap - base, err := filepath.Abs(base) - if err != nil { - return "", err + // Mutlaka absolute olsun + if !filepath.IsAbs(base) { + return "", fmt.Errorf("PDF_FONT_DIR must be absolute: %s", base) } - full := filepath.Join(base, name) + full := filepath.Clean(filepath.Join(base, name)) - // Debug log - fmt.Println("PDF FONT PATH:", full) + // DEBUG + log.Printf("📄 PDF FONT PATH = %s", full) if _, err := os.Stat(full); err != nil { return "", fmt.Errorf("font not found: %s (%v)", full, err)