]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/file_path.go
Add support for Mac Roman character encoding.
[rbdr/mobius] / hotline / file_path.go
index 97ce417e484550202cfb1b4da284ce57ef7c2ef7..620f54d5cd0a5b969ade3237ad57617d65fd370e 100644 (file)
@@ -5,6 +5,7 @@ import (
        "bytes"
        "encoding/binary"
        "errors"
+       "fmt"
        "io"
        "path/filepath"
        "strings"
@@ -119,6 +120,9 @@ func readPath(fileRoot string, filePath, fileName []byte) (fullPath string, err
                subPath,
                filepath.Join("/", string(fileName)),
        )
-
+       fullPath, err = txtDecoder.String(fullPath)
+       if err != nil {
+               return "", fmt.Errorf("invalid filepath encoding: %w", err)
+       }
        return fullPath, nil
 }