fix: Use path and filepath operation appropriately

Using path package methods can cause errors on windows machines.

path methods are used for url operations and unix specific operation.

filepath methods are used for file system paths and its cross platform. 

Remove strings.HasSuffix and use filepath.Ext and path.Ext for file and
url extenstions respectively.
This commit is contained in:
gofastasf
2025-04-01 22:29:43 +05:30
committed by GitHub
parent 6dc8ed710e
commit 2827b2fe8f
6 changed files with 12 additions and 13 deletions

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"io"
"os"
"path"
"path/filepath"
"sync"
"time"
@@ -249,7 +248,7 @@ func createRollingLogger(config RollingConfig) (io.Writer, error) {
}
rotatingFileInit.writer = &lumberjack.Logger{
Filename: path.Join(config.Dirname, config.Filename),
Filename: filepath.Join(config.Dirname, config.Filename),
MaxBackups: config.maxBackups,
MaxSize: config.maxSize,
MaxAge: config.maxAge,