diff --git a/tests.py b/tests.py index 7fcdccd03..b9bac2492 100644 --- a/tests.py +++ b/tests.py @@ -2978,9 +2978,36 @@ def testFunctions(): '-Gsep=+120 -Tx11 epicyon.dot') +def testLinksWithinPost() -> None: + baseDir = os.getcwd() + nickname = 'test27636' + domain = 'rando.site' + port = 443 + httpPrefix = 'https' + content = 'This is a test post with links.\n\n' + \ + 'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://freedombone.net' + postJsonObject = \ + createPublicPost(baseDir, nickname, domain, port, httpPrefix, + content, + False, False, False, True, + None, None, False, None) + assert postJsonObject['object']['content'] == \ + '

This is a test post with links.

' + \ + '' + \ + '' + \ + '' + \ + 'ftp.ncdc.noaa.gov/pub/data/ghcn/v4/' + \ + '

' + \ + '' + \ + 'freedombone.net

' + + def runAllTests(): print('Running tests...') testFunctions() + testLinksWithinPost() testReplyToPublicPost() testGetMentionedPeople() testGuessHashtagCategory() diff --git a/utils.py b/utils.py index 81682d1e1..ad3e2eddf 100644 --- a/utils.py +++ b/utils.py @@ -328,14 +328,16 @@ def removeIdEnding(idStr: str) -> str: def getProtocolPrefixes() -> []: """Returns a list of valid prefixes """ - return ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://', + return ('https://', 'http://', 'ftp://', + 'dat://', 'i2p://', 'gnunet://', 'hyper://', 'gemini://', 'gopher://') def getLinkPrefixes() -> []: """Returns a list of valid web link prefixes """ - return ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://', + return ('https://', 'http://', 'ftp://', + 'dat://', 'i2p://', 'gnunet://', 'hyper://', 'gemini://', 'gopher://', 'briar:')