updated filepaths for multiplatform support (#56)

- Migrate from Go's path to path/filepath to support multi-OS support
This commit is contained in:
somesuchnonsense
2025-04-26 14:59:23 -05:00
committed by GitHub
parent bce51ecd4f
commit 6e2d1e1a7f
5 changed files with 74 additions and 61 deletions

View File

@@ -4,19 +4,20 @@ import (
"context"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
"os/signal"
"runtime"
"syscall"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/rs/zerolog"
"github.com/sirrobot01/decypharr/internal/config"
"github.com/sirrobot01/decypharr/internal/logger"
"github.com/sirrobot01/decypharr/internal/request"
"io"
"net/http"
"os"
"os/signal"
path "path/filepath"
"runtime"
"syscall"
)
type Server struct {
@@ -34,9 +35,9 @@ func New(handlers map[string]http.Handler) *Server {
s := &Server{
logger: l,
}
r.Handle(path.Join(cfg.URLBase, "static")+"/*",
http.StripPrefix(path.Join(cfg.URLBase, "static"), http.FileServer(http.Dir("static"))),
staticPath, _ := url.JoinPath(cfg.URLBase, "static")
r.Handle(staticPath+"/*",
http.StripPrefix(staticPath, http.FileServer(http.Dir("static"))),
)
r.Route(cfg.URLBase, func(r chi.Router) {