This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] msgstore_fs: Escape filenames with url.PathEscape

Message ID
DKIM signature
Download raw message
Patch: +7 -2
Previously, channels with characters like '/' would just get replaced
with '-'. This caused soju+gamja to act very weirdly, like showing
two channels instead of one.

Note: This is my first time contributing to a Go project, please
review this carefully. Seems to work fine for me while testing with
chathistorysync and senpai.

Closes: https://todo.sr.ht/~emersion/soju/208
Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
 msgstore/fs.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/msgstore/fs.go b/msgstore/fs.go
index 00f0e00..a6cfa67 100644
--- a/msgstore/fs.go
+++ b/msgstore/fs.go
@@ -5,6 +5,7 @@ import (
@@ -30,7 +31,7 @@ func EscapeFilename(unsafe string) (safe string) {
	} else if unsafe == ".." {
		return "--"
	} else {
		return strings.NewReplacer("/", "-", "\\", "-").Replace(unsafe)
		return url.PathEscape(unsafe)

@@ -492,8 +493,12 @@ func (ms *fsMessageStore) ListTargets(ctx context.Context, network *database.Net

		targetName, err := url.PathUnescape(target)
		if err != nil {
			return nil, err
		targets = append(targets, ChatHistoryTarget{
			Name:          target,
			Name:          targetName,
			LatestMessage: t,

Message ID
<20230409015114.3562338-1-cat@catcream.org> (view parent)
DKIM signature
Download raw message
Probably better to make a separate EscapeFilename function for
channels, and then unescape the channel name for CHATHISTORY like I
currently do.

This will escape the whole path which won't work with for ex.

Will send an update later today.
Message ID
<20230409015114.3562338-1-cat@catcream.org> (view parent)
DKIM signature
Download raw message
I've been holding off this patch because it behaves differently than
ZNC, which we inherit the log format from. ZNC escapes with "-" as well.
Reply to thread Export thread (mbox)