la5nta / pat

A cross-platform Winlink client written in Go
https://getpat.io
MIT License
488 stars 86 forks source link

pat http truncates filename when attempting to read some msg ids (#?) #303

Closed TheLinuxNinja closed 2 years ago

TheLinuxNinja commented 2 years ago

received message stored in file ~/.local/share/path/mailbox/KR4MM/in/KR4MM#DZKAF7.b2f http gives error when trying to read message in inbox:

Unable to open file (/home/xxx/.local/share/pat/mailbox/KR4MM/in/KR4MM.b2f): open /home/xxx/.local/share/pat/mailbox/KR4MM/in/KR4MM.b2f: no such file or directory

other messages can be read without issue. I attempted to copy file to another filename, but same error even though I see another copy of the message in http inbox.

Message header:

Mid: KR4MM#DZKAF7 Body: 194 Date: 2021/12/02 07:22 From: SERVICE Mbo: SYSTEM Subject: xxx To: KR4MM X-Filepath: /home/xxx/.local/share/pat/mailbox/KR4MM/in/KR4MM#DZKAF7.b2f

Could this be an issue with a '#' as part of the Message ID?

martinhpedersen commented 2 years ago

It certainly smells bad that the MID contains a hash character 🤔

Do you know which software the message originates from?

martinhpedersen commented 2 years ago

Btw, are you able to read the message with pat read?

TheLinuxNinja commented 2 years ago

It certainly smells bad that the MID contains a hash character thinking

Do you know which software the message originates from?

This was a password reset reply message from SYSTEM.

TheLinuxNinja commented 2 years ago

Btw, are you able to read the message with pat read?

Yes, using the CLI allowed me to read the message. I also tested by copying the message to another filename, removing the hash and substituting 'KR4MM1234' as the MID. This worked (but I had to edit the header to match the new filename).

It seems the hash is a valid MID character for WL messages, but pat is unable to parse these properly in the http code.

martinhpedersen commented 2 years ago

This was a password reset reply message from SYSTEM.

Well that's just perfect.

It seems the hash is a valid MID character for WL messages, but pat is unable to parse these properly in the http code.

This is what the winlink "spec" says about the MID header: "The Mid: field is a unique sequence of up to 12 text characters to identify the message system-wide.". "Text characters" is not a very good technical term.

But we need to fix this of course. Probably an issue with the javascript code building the API url for retrieving the message.

Thanks for reporting this 🙂

martinhpedersen commented 2 years ago

We should definitely do proper URL encoding of the mid variable when building URLs here: