RNS Logo

rns.recipes

◈ 9ce92808be498e9e05590ff27cbfdfe4

How to escape "]" in a link to a filename in micron?

Started by jmeshy d0f1dbd3b8cc50c7... ·

jmeshy 667a30ab32a35bfc...
edited #1

Hello there! I promise I RTFMed, i tried and tried ("\]", etc.) nothing seems to work: I want to make links to files that contain "[blah]" in their filename in micron, and this breaks the tags... Anyone has experience with that, and/or could point to a documentation or some examples on how to do this? Thanks! <3

adept 2db1af96591ae4eb...
edited #2

The relevant code might be in the nomadnet repository under files -> nomadnet -> ui -> textui -> MicronParser.py starting from line 763 in the make_output() function.
a8d24177d946de4f1f0a0fe1af9a1338:/page/blob.muʼg=reticulum|r=nomadnet|ref=HEAD|path=nomadnet%2Fui%2Ftextui%2FMicronParser.py

 

I don't have much experience with the Reticulum sources.
But each line is checked for specific characters. It closes the link tag immediately without checking for escape characters.

 

Possible solution:
elif c == "[":
endpos = line[i:].find("]")
if endpos == -1:
pass
elif line[endpos - 1] == "\":
pass
else:
...

 

Don't know anything about security implications with these changes. And have NOT tested it.

 

It should be a good idea to also check for '& endpos > 0' to not misinterpret a backslash at the end of the line if endpos is 0.

 

Does it continue to look for the next occurrence of "]", if it found an escaped "\]"?

Post a Reply

Supports Markdown: **bold**, *italic*, `code`, ```code blocks```, [links](url)

Log in to upload images

Quote
Copied to clipboard