Skip to content

Commit 26caf40

Browse files
committed
serve logo
1 parent 27d3695 commit 26caf40

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

keygen_function/function.go

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package keygenfunction
33
import (
44
"encoding/base64"
55
"encoding/json"
6+
"fmt"
67
"html/template"
78
"net/http"
89
"os"
@@ -57,10 +58,41 @@ func serveLogo(w http.ResponseWriter, r *http.Request) {
5758
w.Header().Set("Content-Type", "image/png")
5859
w.Header().Set("Cache-Control", "public, max-age=86400") // Cache for 24 hours
5960

60-
// Read the logo.png file from the filesystem
61-
logoData, err := os.ReadFile("logo.png")
61+
// Try different possible paths for the logo file
62+
possiblePaths := []string{
63+
"logo.png",
64+
"./logo.png",
65+
"serverless_function_source_code/logo.png",
66+
"/workspace/logo.png",
67+
"/tmp/logo.png",
68+
}
69+
70+
var logoData []byte
71+
var err error
72+
73+
for _, path := range possiblePaths {
74+
logoData, err = os.ReadFile(path)
75+
if err == nil {
76+
break
77+
}
78+
}
79+
6280
if err != nil {
63-
http.Error(w, "Logo not found", http.StatusNotFound)
81+
// Debug: list current directory contents
82+
files, _ := os.ReadDir(".")
83+
var fileList []string
84+
for _, file := range files {
85+
fileList = append(fileList, file.Name())
86+
}
87+
88+
// Also check serverless_function_source_code directory
89+
sourceFiles, _ := os.ReadDir("serverless_function_source_code")
90+
var sourceFileList []string
91+
for _, file := range sourceFiles {
92+
sourceFileList = append(sourceFileList, file.Name())
93+
}
94+
95+
http.Error(w, fmt.Sprintf("Logo not found. Current directory files: %v, Source directory files: %v", fileList, sourceFileList), http.StatusNotFound)
6496
return
6597
}
6698

0 commit comments

Comments
 (0)