diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-03-14 17:41:12 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-03-14 17:41:12 -0700 |
| commit | 72c6ddc104c349a4798fddeaa8f77dbe139fe104 (patch) | |
| tree | aae0dfe993bd8ff298efd286d881ae96017105f9 /internal | |
| parent | b40b4ccdea356807f82e5a33371ca59832ecac8a (diff) | |
Fix Mac Roman decoding incorrectly applied to filesystem root paths
ReadPath() and HandleNewFolder decoded the entire joined path from Mac
Roman, including the fileRoot prefix which is already UTF-8. This caused
file listing failures when config paths or FileRoot values contained
non-ASCII characters. Now only client-provided path components (subPath,
fileName/folderName) are decoded before joining with fileRoot.
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/mobius/transaction_handlers.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/mobius/transaction_handlers.go b/internal/mobius/transaction_handlers.go index 259ac02..33af941 100644 --- a/internal/mobius/transaction_handlers.go +++ b/internal/mobius/transaction_handlers.go @@ -568,11 +568,19 @@ func HandleNewFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotl subPath = path.Join("/", subPath, string(pathItem.Name)) } } - newFolderPath := path.Join(cc.FileRoot(), subPath, folderName) - newFolderPath, err := txtDecoder.String(newFolderPath) + + // Decode only client-provided path components from Mac Roman to UTF-8. + // The FileRoot is already a UTF-8 filesystem path and must not be decoded. + subPath, err := txtDecoder.String(subPath) if err != nil { return res } + folderName, err = txtDecoder.String(folderName) + if err != nil { + return res + } + + newFolderPath := path.Join(cc.FileRoot(), subPath, folderName) // TODO: check path and folder Name lengths |