From 27c17fc33f6a1ca431aa06870e8e5177cf70654d Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Tue, 11 Feb 2025 11:59:35 +0100 Subject: [PATCH] Getting tired --- backend/api/shortcodes/shortcode.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/api/shortcodes/shortcode.go b/backend/api/shortcodes/shortcode.go index e05e722..3ca69d3 100644 --- a/backend/api/shortcodes/shortcode.go +++ b/backend/api/shortcodes/shortcode.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "os" "fr.latosa-escrima/core" "fr.latosa-escrima/core/models" @@ -43,6 +44,9 @@ func HandleShortcode(w http.ResponseWriter, r *http.Request) { // Extract the host host := r.Host baseURL := fmt.Sprintf("%s://%s", scheme, host) + if os.Getenv("ENVIRONMENT") != "DEV" { + baseURL += "/api" + } if shortcode.Media != nil { shortcode.Media.URL = fmt.Sprintf("%s/media/%s/file", baseURL, shortcode.Media.ID) }